Gentoo Wiki




This page was created after I spent a number of hours trying to recover a LVM2 partition atop a RAID1 element. I figured this may save someone else the trouble and stress, or at least mitigate either somewhat.

The configuration that I had before attempting this recovery was thus:

/dev/hdb[1235] + /dev/sda[1234] = /dev/md[1234]

/dev/md1 = /boot
/dev/md2 = swap
/dev/md3 = /
/dev/md4 = LVM2 (main_vg)
 - contained home, opt, usr, tmp, var

Boot a Gentoo Live CD

No other Live CD I possess has the necessary tools to recognize both the raid and the lvm2. Just pop it in and wait for it to load up

Load Necessary Modules

If you are running RAID1, modprobe the following:

modprobe md
modprobe raid1

For LVM2, modprobe the following:

modprobe dm-mod

Prepare RAID

With some Live CDs, the md devices are not immediately present. To enable these, execute the following:

cd /dev 

If you have access to your raidtab/mdadm.conf file, you should copy it into /etc (with the Live CD still being the root), and enable raid via

raidstart /dev/md?

or the mdadm way (TODO: add mdadm directions)

mdadm -E --scan {list of raid devices /dev/hda1 /dev/hdb1} > /etc/mdadm.conf
echo "DEVICE /dev/hda*" >> /etc/mdadm.conf
echo "DEVICE /dev/hdb*" >> /etc/mdadm.conf
mdadm -A -s


mdadm -A /dev/md0 /dev/hda1 /dev/hdb1

View the /proc/mdstat file to ensure the expected number of drives are operational.

Mount the Mundane

Mount the devices that are non-LVM (which may be different for your box):

mount /dev/md3 /mnt/gentoo
mount /dev/md1 /mnt/gentoo/boot

Reestablish Volume Group

To tap into the volume group you wish to work with, make sure /etc/lvm/lvm.conf filters are able to see the /dev/md? devices, and execute the following:


which should display the volume group associated with an md device you enabled. Then, to make the logical volumes (LVs) available for mounting, execute the following:

vgchange -ay {vg name}

Mount the Less Mundane

Now all you need do is mount the reestablished LVs. I find this an excellent time to make use of Bash:

for i in `ls /dev/{vg name}`; do mount /dev/{vg name}/$i /mnt/gentoo/$i; done;

Of course, you must change {vg name} to the name of your volume group, as above.

Retrieved from ""

Last modified: Fri, 05 Sep 2008 08:32:00 +0000 Hits: 9,662