|
In some cases you may need to rebuild/ repair a RAID system from a rescue environment. Depending on the type of failure you may be able to use the rescue tools to automatically mount your existing raid system for repair. However in some cases this is not possible. The following gives some insight into mounting raid partitions from a rescue environment.
After booting into rescue you may not find any raid devices mounted. You can use mdadm to assemble the disks. Lets say we have the following.... 2 * 80gb IDE in a RAID 1 Mirror. /dev/hda1 and /dev/hdb1 = /boot /dev/hda2 and /dev/hdb2 = / /dev/hda3 and /dev/hdb3 = /var /dev/hda4 and /dev/hdb4 = /home create a "/etc/mdadm.conf" in your rescue environment. Inside it put the following... DEVICE /dev/hd[ab]1 DEVICE /dev/hd[ab]2 DEVICE /dev/hd[ab]3 DEVICE /dev/hd[ab]4 Save and quit the file. Now tell mdadm to scan the devices. # mdadm --examine --scan >> /etc/mdadm.conf The mdadm.conf will now show each raid device. From there you can now assemble the raid devices. # mdadm --assemble --scan /dev/md0 # mdadm --assemble --scan /dev/md1 # mdadm --assemble --scan /dev/md2 # mdadm --assemble --scan /dev/md3 You can use mdadm to check the status of the disks # mdadm --detail /dev/md0 Ofcourse you can then mount them up as you normally would. # mount /dev/md1 /mnt/sysimage (where md1 is /) # mount /dev/md0 /mnt/sysimage/boot (where md0 is /boot) etc. Should a drive fail (say /dev/hdb) you can remove it from the raid devices using: # mdadm /dev/md0 --fail /devhdb1 --remove /dev/hdb1 # mdadm /dev/md1 --fail /dev/hdb1 --remove /dev/hdb1 repeat this for each partition. Then you can add a new drive and bring it in. # mdadm /dev/md0 --add /dev/hdc1 # mdadm /dev/md1 --add /dev/hdc2 etc..repeat this for each partition. Check the status of the new drives again using "--detail". The RAID devices will resynch and that can take time. You can speed it up by doing the following... # echo 50000 > /proc/sys/dev/raid/speed_limit_min Once its all happy again, You'll need to reset GRUB. Mount up your drives and "chroot" into them. # grub > device (hd0) /dev/hda > root (hd0,0) > setup (hd0) Reboot and see if you've done it all right. |