Recovering RAID + LVM

1. Boot up

Bootup a recovery CD. This can be the Debian stable CD, you just need a shell.

2. Load the RAID1 module

   modprobe raid1

3. Reassemble both 2 RAID1 arrays

   mknod /dev/md0 b 9 0
   mknod /dev/md1 b 9 1
   mdadm --assemble /dev/md0 /dev/sda1 /dev/sdb1
   mdadm --assemble /dev/md1 /dev/sda5 /dev/sdb5

Note that if some drives are missing (eg: because defective) you can remove them, and for example, do like this for a RAID1:

   mdadm --assemble /dev/md1 /dev/sda5

In some cases, you might need to edit /etc/mdadm/mdadm.conf and use the following:

   mdadm --examine --scan  /dev/sdb1

Add something like this:

   ARRAY /dev/md2 level=raid1 num-devices=2 UUID=bd39d4eb:3543b935:274a4b6d:bd848ac0
   ARRAY /dev/md3 level=raid1 num-devices=2 UUID=2ceb49f4:ff318387:61fc9b95:7265e806

then simply do:

   mdadm --assemble /dev/md2

4. What to do if reassembling the RAID array doesn't work

If when you rebuild your raid with mdadm --assemble /dev/mdX /dev/sd[a-d]1 and mdadm assembly function raid can't found all hard drives, you must check the Event Hard disk (mdadm -E /dev/sda1. If event is not egal, you must use this fonction.

Here is an example with 4 disks in RAID5:

    mdadm --create --assume-clean --verbose /dev/md0 --level=5 --raid-devices=4  /dev/sda[a-d]1

Note : this fonction create a new raid 5 ( --create + --level=5) , and will NOT erase your data (--assume-clean). If your raid5 has 4 hard drives device use --raid-devices=4.

After this function , you can mount your raid , but your raid has been degraded mode. You must rebuild the raid5. To run rebuild raid, you can remove a hard drive from the array and reinsert it:

Say to the system that sdd1 hardrive failed:

   mdadm --fail /dev/md0 /dev/sdd1 

Remove the sdd1 hardrive:

   mdadm --remove /dev/md0 /dev/sdd1

Readd ssd1:

   mdadm --manage /dev/md0 --add /dev/sdb1

Then check the rebuild with cat /proc/mdadm

5. Activate the LVM volume groups

Find the volume groups:

   vgscan

Make them available:

   vgchange -a y

6. Mount the LVM logical volumes

Use lvs or vgdisplay/lvdisplay to show your partitions:

   lvs

Mount (here with vg0 as volume group and example as logical volume):

   mount /dev/mapper/vg0-example /mnt/example


Editing this page means accepting its license.

Page last modified on March 13, 2009, at 09:44 AM EST