Sunday, May 19, 2013

HOWTO: Boot from either member of RAID 1 mirror in Linux

Our staging server (running Debian Wheezy) recently lost one of it's mirrored RAID 1 volumes. (Mounted on /var/backups ).

After the helpful email from both mdadm and smartmond (enable in /etc/default/smartmontool). I replaced the drive, per the fine mdadam manual.

All went well, until for fun, I decided to check if the server would boot with only half of /dev/md0 (mounted on / ) available. The server didn't boot.

After some head scratching, I realized I hadn't installed grub in the MBR of both discs.  The RAID array (mirror) is defined in terms of volumes , or partitions, not discs. To install grub on both MBRs I had to:
     sudo dpkg-reconfigure grub-pc
Though it would have worked as well to:
    sudo grub-setup /dev/sda
    sudo grub-setup /dev/sdb
Once Grub was on both MBR, all was good.