[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Booting degraded software raid1 with failed /dev/sda



Background.
I have Debian Wheezy 64bit installed on a machine with 2 SATA drives. On the hard drives I have two software RAID1 partitions, md0 and md1. The bigger md1 uses LVM and has separate volumes for swap, /tmp, /var, /opt, /usr, and /home. Everything was working fine, until one day the sda disc crashed and the system was not bootable anymore. This is how I have learned that by default Debian installs grub only on /dev/sda in RAID1 configuration. Despite the fact that /dev/sdb was still fine, I had no working system, as I couldn't boot it. After two days of Google search I have found a solution, which might be of interest to somebody in similar situation.

Solution.
First, I downloaded the debian-live-7.0.0-amd64-rescue.iso, it fits on one CDROM. I could boot from it into a live system. To get a root privileges I set root pasword: "sudo passwd root" and then su to root. Because BIOS already reported first HD error, cfdisk was showing me only one HD, /dev/sda (before crash it was /dev/sdb). However, RAID1 was still alive, "cat /proc/mdstat" reported two degraded partitions, md126 and md127, the first one was my former md0 and the second the former md1. As I didn't have LVM on md0 I could mount it directly: "mount /md126 /mnt". Volumes on md1 were also fine, lvscan listed all of them. I have mounted one by one: "mount /dev/vol/usr /mnt/usr", "mount /dev/vol/var /mnt/var", mount /dev/vol/tmp /mnt/tmp". Then, in preparation for chrooted environment I also mounted proc and dev: "mount -t proc none /mnt/proc" and /mount -o bind /dev /mnt/dev". After that "chroot /mnt" and I was in my installed system. Fixing grub was a matter of the command: "grub-install /dev/sda", which didn't report any errors. Ctrl-D returned me to the live system, from which I have rebooted. Fingers crossed -- after some delay caused by errors generated by the failed HD (which is still inside the computer) I was finally greeted by login screen. My system is running fine now with the degraded RAID array, waiting for the arrival of a new drive.

Cheers,
  Tad




Reply to: