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

Re: Booting degraded software raid1 with failed /dev/sda



Tad Bak wrote:
> 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,

A typical configuration.

> 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.

That is a common situation that seems to be discussed here every month
or so.  A recurring topic.  Sorry to hear that you have had this
trouble too.

> 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

I personally think it is easier to use the debian-installer in rescue
mode to recover in this situation.  I have written about hte process
here often.  Here is one recent posting of mine on the topic.

  http://lists.debian.org/debian-user/2013/06/msg00770.html

But perhaps this one is better.

  https://lists.debian.org/debian-user/2013/01/msg00218.html

I recommend using one of the smaller debian-installer images such as
the netinst image.  It is small to download and can be burned to cdrom
or copied to a usb disk and booted.

> 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".

It is this point that I think makes the debian-installer easier to
use.  It has a helper dialog for assembling raid and lvm.  Simply
activate automatic raid assembly.  Then activate lvm.  Then select the
root partition.  After that and chrooting into the system you can do
'mount -a' to mount all of the additional partitions all at once.  And
then you can repair your 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.

Glad to hear that you were able to recover okay!  Software RAID1
worked and even though you had a failure none of your data was lost.
Now don't delay and replace that bad disk!  And check that your backup
is still working and current because RAID is no substitute for backup.

Bob

Attachment: signature.asc
Description: Digital signature


Reply to: