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 SVN, so if you have multiple volume groups you should get the latest version from SVN.

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 _chain pc gpt biosdisk lvm

The core.img is usually installed outside of logical volumes so that it's physical location doesn't change on it's own.

For IBM/MS-DOS partitions this means that there should be ample space between the MBR and the start of the first partition so that the core.img can be written there.

When using GPT there isn't any free space available between the MBR and the first partition since this area is used by the GPT. When you want to store the core.img on a GPT labeled device, you need to create a BIOS Boot Partition, which GRUB will detect and use.

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.

TODO

* Example grub.cfg


CategoryDocumentation

GrubWiki: LVMandRAID (last edited 2009-01-19 23:07:34 by tg)