Software Mirror RAID

Could someone clarify what functionality the Software Mirror RAID that is created automatically by the distro should be able to handle?

For example, I tested unplugging one of the drives, and just received a “GRUB” message on the screen when trying to boot.

I was hoping I’d be able to take one of the drives out and re-build the RAID on both the original server, and on a new one with the removed drive. Is that possible?

It’s RAID1 (mirroring) which does in fact protect you from a single drive failure so you won’t loose your data with the drive.

Due to grub only installing to one of the drives, you have a 50/50 chance of the drive that dies being the one with the boot-loader installed.

So the fix is to install grub to both drives… follow these instructions and you should achieve what you want to do.

I could give this a shot, but wondering if any of the developers have a comment about this, since the distribution was setup to install this way… what good is the RAID 1 mirror without a properly bootable system? I think I tried installing with hardware RAID originally, but couldn’t with the distro, so settled for the built-in software RAID.
Hopefully there’s a good answer on how to handle this RAID 1?
Thanks for the feedback…

I was able to successfully boot from either drive, as well as replace a drive and rebuild the RAID. I realize this isn’t really a function/feature of FreePBX, as it’s really the OS, so I thought I’d share what I did in case anyone else needed help:

First, make both drives bootable (as explained in the above link) or while your system is up and running. This would be the most important thing you can do BEFORE you have a failure!

1.Make sure you’re root.
2.Input the command “/sbin/grub”, hit Enter
3.Enter the following commands in the GRUB shell:
grub> device (hd0) /dev/sda
grub> device (hd1) /dev/sdb
grub> root (hd0,0)
grub> setup (hd0)
grub> root (hd1,0)
grub> setup (hd1)
grub> quit

Once this is complete, both your drives are bootable should one fail (or you unplug one, etc.).

Now, if there is a failure on the primary boot drive, you’ll still get a GRUB error, but you can easily change the hard drive it’s trying to boot from between hd1 or hd0 (use the ‘e’ option to edit from the GRUB menu).

Now, to replace the drive and re-build the mirror (swap sda/sdb depending on what drive failed):

1.Create the exact same partitioning as on /dev/sda. We can do this with one simple command:
sfdisk -d /dev/sda | sfdisk /dev/sdb
2.Next, add the new partitions to the active RAID:
mdadm --manage /dev/md0 --add /dev/sdb1
mdadm --manage /dev/md1 --add /dev/sdb2
mdadm --manage /dev/md2 --add /dev/sdb3
3.Verify RAID is syncronized using:
cat /proc/mdstat

You can also use these commands to see the RAID status of each:
mdadm --detail /dev/md0
mdadm --detail /dev/md1
mdadm --detail /dev/md2

For example, during re-building of md2 for a new drive it will show:
State : clean, degraded, recovering
Active Devices : 1
Working Devices : 2
Failed Devices : 0
Spare Devices : 1

Rebuild Status : 45% complete

       UUID : ffc9b989:beb4db11:2b5b4783:ab923a03
     Events : 0.1578

Number   Major   Minor   RaidDevice State
   2       8        3        0      spare rebuilding   /dev/sda3
   1       8       19        1      active sync   /dev/sdb3
1 Like

I was going to log on and complain about the Partitioning not coming up during the install, but in looking at this post I assume that if I have two SATA drives that the distro will automatically create a software mirror - Excellent!

I case you don’t know how, here is the HowTo I always use when setting up Software RAID. I typically use Elastix, so I have to manually set up the RAID partitions myself - this HowTo supplies the final step in making the GRUB boot from either drive:

.PDF it for yourself so you always have it available (at least until you memorize it).


P.S. - Nice meeting everyone today here at Astricon!

We have a fix for this with the latest Beta Distro using Centos 5.7