Next Previous Contents

6. Using LVM for root partition

6.1 Problem descriptions

Boot process

To work with LVM the kernel must suppor LVM.

To load a kernel that supports LVM, it must be saved in a not LVM partition.

To load a kernel from a not LVM partition, the /boot partition CAN'T be LVM.

Therefore, it should be clear that at least /boot must be in a separate partition and this partition can't be member of a VG.

System recovery

If you can't boot your system anymore (yes, this can happen also with Linux ;-(), you need a third rescue system. This system can be on an other partition, on an other disk or on a CD. It MUST contain at least the following things:

If you don't have all these things, BE CAREFULLY deciding to move your system to LVM. In case of disaster you will have a nice Linux Box ... without Linux!!!

6.2 Kernel

To boot a LVM system, the kernel must contain the following elements:

These elements must be build as part of the kernel (set to "y") and not as module.

If you don't know how to create a kernel under Debian, please refere you to

http://www.de.debian.org/doc/manuals/reference/ch-kernel.en.html

6.3 Configuration file /etc/fstab

The mount device for the root partition must be changed like

/dev/GROUP/NAME / ext3 defaults 1 1

This will mount the LVM root filesystem.

6.4 LVM initial RAM disk

Before mounting the root filesystem, the loaded kernel needs a filesystem. Therefore a RAM disk is needed. You can create one by calling

lvmcreate_initrd VERSION
where VERSION is the kernel version (e.g.: 2.4.20) and is optional. If it isn't specified, the current kernel version will be used.

This will create a RAM disk in /boot called something like this

initrd-lvm-KERNEL_VERSION.gz
where KERNEL_VERSION is your kernel version (e.g.: 2.4.20).

Note: Read the size of the loopback file. You need later this information for the /etc/lilo.conf file.

6.5 Configuration file /etc/lilo.conf

The options for booting your kernel must be changed like

image = /boot/KERNEL_IMAGE
label = LABEL
root = /dev/GROUP/NAME
initrd = /boot/initrd-lvm-KERNEL_VERSION.gz
ramdisk = RAM_DISK_SIZE

where KERNEL_IMAGE is the file name of your kernel image, LABEL is the name you want to display at boot time by LILO, KERNEL_VERSION is the version of your kernel and RAM_DISK_SIZE is the size of your ramdisk.

The default value of the ramdisk is generally 4096. Please check what is your loopback file size and update the RAM_DISK_VALUE. It must be bigger-equal as your loopback file!

Don't forget to update LILO calling

lilo

You should now be able to boot your LVM system.


Next Previous Contents