LVM and RAID

GRUB has support for LVM and RAID since version 1.95. Multiple volume groups don't work with GRUB 1.95 however. This bug has been fixed in CVS, so if you have multiple volume groups you should get the latest version from CVS.

modules

The modules required to make LVM and RAID work are 'lvm' and 'raid', respectively.

grub.cfg

To enable LVM support, place the following in your grub.cfg file:

    insmod lvm

Similarly, RAID support can be enabled by placing the following in your grub.cfg file:

    insmod raid

You will then be able to get the RAID and/or LVM volumes listed in the grub command line, typing 'ls'.

RAID

For RAID arrays, the same name is used as the Linux devicename. E.g. if the array is /dev/md2 under Linux, its GRUB name is (md2). The number is taken from the superblock. If it happens that there are two different arrays with the same number in their superblocks the first free number is used.

LVM

LVM volumes are named (volumegroup-volumename). This is the same format as the name of the devices in /dev/mapper.

core.img

If your boot partition (the one containing grub data) is part of an LVM, the module must be part of your core.img rather than being loaded at grub.conf processing time. In order to create a core.img with lvm support, perform the following:

    grub-mkimage --output=/boot/grub/core.img ext2 pc gpt biosdisk lvm

Do take care that the core.img should be installed outside logical volumes (and probably outside any raid array), this means that there should be ample space between the MBR and the start of the first partition to contain the core.img file.

pc-style partitions

If your Physical Volumes are PC-style partitions, you must put the pc module before the lvm module in core.img.

/boot on RAID or LVM

Installing GRUB while /boot is on RAID and/or LVM should be straightforward. Grub-setup will detect that and specify the GRUB root device/prefix accordingly, so GRUB will be able to find the files in /boot. If you have a RAID array you can specify the RAID device as destination device. Grub-setup will look at the members of the RAID array and install on the MBR of each disk.


CategoryDocumentation

GrubWiki: LVMandRAID (last edited 2008-05-16 18:52:04 by VesaJääskeläinen)