Debian Admin - Your way to Debian World

March 5, 2007

Pain of the LVM and Fix

by @ 6:23 am. Filed under General

If you're new here, you may want to subscribe to my RSS feed. Thanks for visiting!

Problem domain:

I have started to use LVM(2) and converted my system on lvm2 devices. I have noticed that I need to use initrd in order to boot up because all of my partitions were using lvm except /boot. I had 2 versions of debian-netsint on CD. I could boot up with them and with some debian kernel (2.6.8-2)installed from deb, but not the kernel I have complied (2.6.20). I got a kernel panic: missing root device and init: dev/console was missing.

Path to solve:

I realized that I have to try to use udev. I tried to create my initrd with mkinitrd. It was quite flexible with transfering files to my initrd, but it turns to be a dead end.

I have realized that one of the cause was devfs have been removed from the kernel around version 2.6.13-17. Thanks Linus it was a great idea to drop it this point from the 2.6 tree. I have thought that the stable tree is not a playground.

I have switched to mkinitramfs. It looks a bit complicated for the first look. It took some time to hook on. My first advice is use the break option, so it will stop after init-premount level and execute a shell.

Needed things to boot from an LVM root:

  1. Having required kernel features loaded from modules.
  2. Having those disk devices created holding the lvm volumes to boot on
  3. Having and running vgchange -ay

My way:

/etc/initramfs-tools/initramfs.conf:

MODULES=list

BOOT=local

This is my hook script:

/etc/initramfs-tools/hooks/lvm:

#!/bin/sh -e

PREREQS=”"

prereqs() { echo “$PREREQS”; }

case “$1″ in
prereqs)
prereqs
exit 0
;;
esac

. /usr/share/initramfs-tools/hook-functions

copy_exec /lib/lvm-default/lvm /sbin/

/etc/initramfs-tools/scripts/init-premount/my_lvm:

case $1 in
# get pre-requisites
prereqs)
prereqs
exit 0
;;
esac

# Do the work here.

mkdir /dev/mapper
/bin/mknod /dev/hda1 b 3 1
/bin/mknod /dev/hda2 b 3 2
/sbin/lvm vgchange -ay

# Handle an error:
Well, my hook script transfers the actual running lvm to initrd and the script: my_lvm makes the rest of the work.

Have fun! I hope I could save some headaches with this cookbook.

Tags: , , ,

You may also be interested in...

2 Responses to “Pain of the LVM and Fix”

  1. undefined Says:

    don’t know why the manual customization is necessary as i recently switched from yaird to mkinitramfs on a “root on lvm2 over software raid” 2.6.15 and 2.6.18 etch setup, but without any problems.

    (i switched to mkinitramfs as it appears to be the most mature, the ubuntu/debian default, and the long(er)-term solution.)

    the default works but i later customized the configuration to deactivate unnecessary scripts and modules that were being ran/loaded at boot, but that didn’t require anything more than editing config files and removing/renaming scripts.

    i definitely didn’t have to create nor edit any scripts.

  2. phoenixlpr Says:

    I have updated my sid before. It was not working. I’ve put a 2.6.18-4-686 kernel up from deb(debian-testing-i386-netinst.iso) and it still was not working.

    After all I have started to digg into the initrds. I prefer initramfs-tools, its more flexible.

    I’ve installed from the same netinst disk(2.6.18-4-686) to my HP laptop. It was not booting again. :( .

Leave a Reply

Subscribe RSS Feed

subscribe to the Debian Admin RSS feed

Internal links:

Sponsors:



Categories:

Support Debian Admin

Amount $:
Website(Optional):

Sponsors:

Archives:

Related Links:


Favourite Sites:

Wordpress Collection
Windows Reference
Ubuntu Geek
DebianHelp
All About Debian Tutorials
Power Electrical
Check Your IP Here
Debian,Ubuntu News
DebCentral
Tuxmachines
Capnkirby
Libervis
Nuxifield
Linux Horizon
Linux Appfinder
Debuntu
GNU/Linux For Everyone
Free Penguin
DebianAdmin is not related to the Debian Project.
This site is copyright © 2006,2007 Debian Admin
All Trademarks are the property of their respective owners.
The contents of this website may not be mirrored or archived without the express written permission of DebianAdmin Site Owner.

DISCLAIMER: All the information, troubleshooting methods, utilities offered in this website is provided AS-IS, without any warranties. Though I strive for perfection, and always test the validity and effectiveness of the troubleshooting content in various systems, I assume no responsibility for your use of these Fixes, Utilities and other troubleshooting advice. The author will not be liable for any special, incidental, consequential or indirect damages due to loss of data or any other reason. All use is completely at your own risk. Changes to the existing content and new additions are made to this website periodically, without notification.
Rodney's Kontera DynamiContext Plugin plugged in.