Recover linux software raid from recovery cd without losing losing data

From Open CSTA

Jump to: navigation, search
  • modprobe raid1
  • modprobe dm-mod

make nodes

mknod /dev/md1 b 9 1
mknod /dev/md2 b 9 2
mknod /dev/md3 b 9 3
  • Knowing the previous configuration is handy.
  • Writing the config to /etc/mdadm.conf
  • examine scan to get the UUID
  • Write remainder of config to /etc/mdadm.conf
  • assemble array and run it
echo "DEVICE /dev/sda1 /dev/sdb1" >> /etc/mdadm.conf
echo "DEVICE /dev/sda2 /dev/sdb2" >> /etc/mdadm.conf
echo "DEVICE /dev/sda3 /dev/sdb3" >> /etc/mdadm.conf
echo "DEVICE /dev/sda4 /dev/sdb4" >> /etc/mdadm.conf
mdadm --examine --scan
echo "ARRAY /dev/md1 UUID=<output from above command>" >> /etc/mdadm.conf
echo "ARRAY /dev/md2 UUID=<output from above command>" >> /etc/mdadm.conf
echo "ARRAY /dev/md3 UUID=<output from above command>" >> /etc/mdadm.conf
echo "ARRAY /dev/md4 UUID=<output from above command>" >> /etc/mdadm.conf
mdadm --examine --scan
/sbin/mdadm --assemble --verbose --run /dev/md1
/sbin/mdadm --assemble --verbose --run /dev/md2
/sbin/mdadm --assemble --verbose --run /dev/md3
cat /proc/mdstat 

Then you can chroot to your environment to fix whatever is wrong - usually a kernel module is missing or grub is misconfigured.