What Advantages are there to installing GRUB on a software RAID-1?

What Disadvantages are there to installing GRUB on a software RAID-1?

I ask this because most tutorials/help sections seems to assume that GRUB is on a normal (i.e not on a RAID) partition.

So is there a strong case against installing GRUB on a software RAID? or is this just convention?

Everything below is a reflection of my limited knowledge, be warned it is bound to contain errors. If you find errors I'd appreciate it if you offered corrections or/and explanations, Thanks :0)

So for me personally having installed to RAID-1 it's made tutorial/recovery instructions more confusing. e.g fsck /dev/sda1 is OK for non-RAID systems but NOT something that should be done on individual md drives (AFAIK).

Also my understanding is that since it's a software RAID that a failure on the first boot drive will halt booting anyway. (I.E. can only use RAID-1 for boot because actually it's not loaded as a RAID drive initially until enough of the OS has loaded to manage md drives. So it's only reading data from the first drive anyway when loading GRUB)


Grub 2 (also known as Grub 1.9x) supports Linux RAID-1 natively. Grub 1 (also known as Grub 0.9x or Grub Legacy) does not, but you can largely pretend it does, because Grub only reads from the disk, and reading from one of the disks of a RAID-1 array is as good as reading from the array (except for performance, but this doesn't matter here; and unless one of the disk fails, but then BIOS disk reordering would typically make Grub read from the non-failing disk anyway).

So if you set up Grub on the boot disk, and make the partition containing Grub a RAID-1 device together with the second system disk (with Grub 1, run grub-install once for each disk), then your system will still boot if either disk fails. This is the one advantage of having Grub over RAID-1, but it's a big one.

There is no operational downside to having Grub on a RAID-1 setup. There may be a setup cost, however: many Linux installation programs aren't quite up to task yet with booting nontrivial setups. You may find that you have to create or edit /boot/grub/device.map by hand.

You may find that older documents (from the time of Grub Legacy) say that Grub doesn't support RAID. That's true, but as I wrote above, you get read-only RAID-1 support largely for free (other RAID modes are right out). Not all tutorials have been updated for Grub 2 yet, and even with Grub 2, support in installation programs isn't always fully there yet. So I do recommend putting Grub 1 over a RAID-1 array, but only if your distribution's installation program supports it or you're comfortable with fiddling with Grub's configuration (possibly having to boot from CD a few times before you get it right).

  • Surely on loading GRUB a software RAID is in fact not a RAID as is is only reading from the first bootable disk? So until the mdraid driver is loaded, the data on the 2nd HDD is effectively little more than a "backup copy". As for the BIOS reordering the drives, does that really work with out user intervention? I can see that happening for an unplugged drive but uncertain that a BIOS would reorder on most if any read errors. As for installing GRUB on RAID-1 I thought it was easy on Ubuntu to install, it's the maintenance that seems to be more technical and less well documented. – 10ToedSloth Dec 29 '11 at 7:03
  • @10ToedSloth Grub2 supports RAID as RAID. Grub1 just reads from one of the disks; but at this stage a backup copy is enough (assuming total disk failure; but that's the most common kind). The BIOS boots from the first disk that responds; if the first disk has completely failed, the BIOS will naturally boot from the second disk (the first working disk). – Gilles 'SO- stop being evil' Dec 29 '11 at 11:21

It is a good idea to install GRUB on your software RAID device (if you are using one) because if your RAID device becomes degraded, your system can still boot. If it is not part of the RAID device, then the boot sector has no redundancy, and you may be unable to boot in the event of hard drive failure or filesystem corruption. I'm not aware of any disadvantages in installing GRUB on software raid.

Perhaps the reason why most documentation assumes that GRUB is not installed on a RAID device is that it was not possible until fairly recently. GRUB legacy does not and will never support this, but even GRUB 2 only began supporting it for versions that were released in the last year or so.

To elaborate a little further, GRUB 2 is designed in a modular fashion. So, GRUB adds enough functionality, by loading necesssary modules (if needed) to recognize the boot device, before it proceeds with the boot. Here is a snippet from my config for my 2.6.32 kernel on Debian squeeze, LVM on top of RAID 1, grub-pc version 1.99~20110112-1. Here it loads the modules raid, mdraid1x and lvm before proceeding with the boot, since the device is a LVM logical volume on top of a RAID 1 device.

    insmod raid
    insmod mdraid1x
    insmod lvm
    insmod part_msdos
    insmod part_msdos
    insmod ext2
    set root='(debian-boot)'
    search --no-floppy --fs-uuid --set=root 93ea47bb-16a1-4b52-a7eb-f17ea430d6cf
    echo    'Loading Linux 2.6.32-5-vserver-686-bigmem ...'
    linux   /vmlinuz-2.6.32-5-vserver-686-bigmem root=/dev/mapper/debian-root ro  quiet
    echo    'Loading initial ramdisk ...'
    initrd  /initrd.img-2.6.32-5-vserver-686-bigmem

This is easy to test, so I recommend some experimentation.

  • I agree that it's not complicated to install. But maintenance does appear to be somewhat more complex (at least to a newbie like me). I've had GRUB installed on a software RAID-1 partition for over a year now. Sure it worked fine but now that I have to repair my boot partition it does appear harder than if I had just installed to a single drive. – 10ToedSloth Dec 28 '11 at 6:12
  • @10ToedSloth: How so? You could post the details as an answer, since this would address the disadvantages portion of the question. – Faheem Mitha Dec 28 '11 at 6:17
  • ah, well you see ... My server has stopped booting details here askubuntu.com/questions/90497/… and as a newbie I'm finding the repair process more complicated because of the RAID combined with my ignorance of linux. Think I could have recovered by now just following on-line help if I'd just been on a HDD not md – 10ToedSloth Dec 28 '11 at 6:21
  • @10ToedSloth: I see. Well, wrt to your question, you could reasonably post it here, since it is not Ubuntu specific as far as I can tell. – Faheem Mitha Dec 28 '11 at 6:26
  • You're probably right about posting here instead. But since I'm using Ubuntu 10 server I thought the askUbuntu community was the right place. – 10ToedSloth Dec 28 '11 at 7:10

I am talking about the old grub here.

Pro: Changes to the boot-menu, Kernel-Updates and Init-RDs will go automatically to both (or more) disks. No need to copy manually.

Contra: You have to be careful when setting up the raid 1. Doing it in the wrong order will render your second disk unbootable. The problems are: grub is not able to use a raid-device. So it will use /dev/hdaN or /dev/sdaN instead. But: if your current sda fails the former sdb will become sda.

The solution is: Set up as single partition, but leave a little space at the end of the partition so you can add the meta-information for raid 1 later on without data loss.

Install the MBR on the first disk, install grub on the first disk. Copy both with dd to the second disk. Only after this set up a raid1.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.