initramfs support

Alexander E. Patrakov patrakov at ums.usu.ru
Mon Jul 2 19:44:56 PDT 2007


Bryan Kadzban wrote:
> Is there any kind of qemu setup I can do to test LVM?  Or should I just
> start doing some reading?  (Maybe it's obvious how it's supposed to
> work.)

LVM is very easy as long as you have a /boot partition. I.e., create a 
virtual disk and partition it as follows:

/dev/hda1 (type=Linux) 50 MB /boot (ext3)
/dev/hda2 (type=Linux LVM) the rest of the disk

Then prepare the LVM partition:

pvcreate /dev/hda2

Create a volume group and some volumes:

vgcreate myvg /dev/hda2 # the name "myvg" is arbitrary
lvcreate --size 2G --name root myvg
lvcreate --size 3G --name home myvg

Create filesystems on /dev/hda1, /dev/myvg/{root,home}, mount them, transfer 
LFS there. Swap on LVM should also work out of the box.

Install GRUB as you would normally do. In initramfs and bootscripts, do 
(just after dmraid, or, if there is no dmraid, just after udev):

vgchange -ay --ignorelockingfailure # in both places, just in case
vgmknodes                           # only in bootscripts

and use /dev/myvg/root as a root device.

Some distributions attempt to deactivate LVM and dmraid in their shutdown 
sequence with the following commands:

vgchange -an --ignorelockingfailure
dmraid -an -i

but this would obviously fail if the root device is on LVM or dmraid. So, if 
you do this, make sure that the bootscripts don't display a red error if the 
above commands fail.

Things become a bit more complicated if there is no /boot partition (BTW, 
one can have LVM over the whole /dev/hda, without _any_ partitions). In this 
case, the only difference is that GRUB won't work and you'll have to install 
LILO.

BTW, "LVM on /dev/mapper/hpt*" is also a valid setup - please make sure that 
it works with your initramfs.

Once we have this working, the next task is hibernation.

-- 
Alexander E. Patrakov



More information about the lfs-dev mailing list