Linux: How To Make RAID-1 Disks Independently Bootable

By Angsuman Chakraborty, Gaea News Network
Sunday, October 5, 2008

The best part of Linux (imho) is the ability to replicate not only the operating system or the data but also the boot loader. This allows you to have two identical disks running RAID-1, each of which are independently bootable, should one of them fail. You can also add spare disks to the RAID-1 array to automatically use it to reconstruct the RAID-1 array when one of the RAID-1 disks fail. However configuring it may not always be the simplest. Let’s see if I can simplify it for you.

The boot partition (primary partition) can be RAID-0 or RAID-1. Only a fool would configure the boot device as RAID-0 and double the chance of failure. However when you configure it as RAID-1, you are making your boot device 100% redundant and hence robust.

BTW: Can you boot on a RAID-1 drive in Windows? … NO.

Creating the primary partition as a RAID device in both of your hard-disk and then configuring it as a RAID-1 device is a breeze using Disk-Druid in Anaconda during installation. I will not detail it here as you can search for it easily if you need help. However try taking out one of the disk from the RAID-1 array and booting will very likely fail even after you have configured your boot device to be RAID-1. You need to transfer the grub to both the hard-disk. Suppose your hard disks are hd0 & hd1 (look below to find out). To install grub on both the devices do the following:

# grub
grub> root (hd0,0)
grub> setup (hd0)
grub> root (hd1,0)
grub> setup (hd1)

This installs grub on both hd0 & hd1.

How to find out which are the hard disks on which you can install grub?

# grub
grub> find /grub/stage1

This will list your drives like (hd0,0), (hd1,0) etc.

How to prevent fsck’ing drives during booting?

One final problem I faced was that I mounted the partitions from both the drives to separate sub-directories. Fedora 8 fsck’s file system (checks data integrity of the data & the partition) during boot like Windows. This creates a problem as it cannot find the failed / removed drives and drops you to the dreaded recovery prompt. The solution is to open /etc/fstab and change the last parameter of the mounted partition from 2 to 0. For example I mounted the remaining space of my two harddisk as follows:

LABEL=/var/www/html/a   /var/www/html/a         ext3    defaults        1 2
LABEL=/var/www/html/b   /var/www/html/b         ext3    defaults        1 2

This creates problem when any one of the disk is pulled out or fails. To avoid that I changed the fsck parameter to skip fsck’ing during boot:

LABEL=/var/www/html/a   /var/www/html/a         ext3    defaults        1 0
LABEL=/var/www/html/b   /var/www/html/b         ext3    defaults        1 0

Preventing fsck during boot may have unintended consequences which I am not aware of. However as the partitions will be primarily read-only we are safe.

Discussion

Fabrizio
July 30, 2010: 5:21 am

Unfortunately, it seems that this system works only if fail disk HD0 (sda). If the failed disk is sdb (HD1) it won’t boot, even installing grub on both sda and sdb after starting the array…

Anyway I’m using Ubuntu 10.04 which has grub2 instead, I don’t know if this coud make some difference anyway.

Best regards.


SARAVANAKUMAR S
February 5, 2009: 6:13 am

Good one. Thanks.

It solved my problem.

YOUR VIEW POINT
NAME : (REQUIRED)
MAIL : (REQUIRED)
will not be displayed
WEBSITE : (OPTIONAL)
YOUR
COMMENT :