Wednesday, August 17, 2005

Software RAID on FC4

This is my configuration: 1GB*3 for /dev/md0 as RAID1 mirror on /boot while 36GB for /dev/md1 as RAID5 on the root (/). So in the end I have 1G for /boot (actually too much) and 71G for the root. I tested two scenarios as followed:

  1. One disk removed then reconnected.
  2. First disck failed.

To reconnect a raid member back to RAID1/RAID5, use this example: mdadm /dev/md0 -a /dev/hdb2, before doing this, a mdadm -D /dev/md0 can give you more idea. Every time you disconnect a disk and boot it up, you have to re-add the missing disk next time. Damn you software raid....

One the problem we can see is that if the first disk fails, the machine cannot continue its service because the grub is still on the first disk (e.g., /dev/hda). To solve this, we can install grub in any disk other than first one. Why? Because if two disks fail, it dies. Then we can run grub to setup.

grub>   device (hd1) /dev/hdb
grub>   root (hd1,0)
grub>   setup (hd1)
Use exit or quit to leave grub. Now edit the /boot/grub/grub.conf, add this line before the first title line:
fallback=1
(supposed that you have only one boot menu, if the first menu fails, it goes to the second menu.) and copy the first menu and append after first menu, but replace hd0 to hd1. Now it's done. This is my grub.conf:
default=0
faillback=1
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title Fedora Core (2.6.11-1.1369_FC4)
        root (hd0,0)
        kernel /vmlinuz-2.6.11-1.1369_FC4 ro root=/dev/md0 rhgb quiet
        initrd /initrd-2.6.11-1.1369_FC4.img
title Fallback Fedora Core (2.6.11-1.1369_FC4)
        root (hd1,0)
        kernel /vmlinuz-2.6.11-1.1369_FC4 ro root=/dev/md0 rhgb quiet
        initrd /initrd-2.6.11-1.1369_FC4.img
Now we can allow the first disk failing and still boot ....

No comments: