In my setup, I have two disks that are each formatted in the following way:

2)  300MB LINUX_RAID   
3)  *     LINUX_RAID   

The boot partitions are mapped in /dev/md0, the rootfs in /dev/md1. md0 is formatted with ext2, md1 with XFS. (I understand that formatting has to be done on the md devices and not on sd - please tell me if this is wrong).

How do I setup GRUB correctly so that if one drive fails, the other will still boot? And by extension, that a replacement drive will automatically include GRUB, too? If this is even possible, of course.

3 Answers 3


If the two disks are /dev/sda and /dev/sdb, run both grub-install /dev/sda and grub-install /dev/sdb. Then both drives will be able to boot alone.

Make sure that your Grub configuration doesn't hard-code disks like (hd0), but instead searches for the boot and root filesystems' UUIDs.

I'm not aware of support in Grub to declare two disks as being in a RAID-1 array so that grub-install would automatically write to both. This means you'll need to run grub-install again if you replace one disk; it's one more thing to do in addition to adding new members to the RAID arrays.

  • 1
    "Make sure that your Grub configuration doesn't hard-code disks like (hd0), but instead searches for the boot and root filesystems' UUIDs." How? Mar 7, 2018 at 18:56
  • 1
    @lifeofguenter With search Mar 8, 2018 at 7:46
  • 1
    thanks @Gilles can you be a little more precise? (I don't need a snippet, but at least a link to a documentation I can read up on? I did notice that device.map should most probably be missing? Mar 8, 2018 at 13:33
  • 1
    gnu.org/software/grub/manual/grub/grub.html#GNU_002fLinux or look at your distribution's file Mar 8, 2018 at 21:45
  • 1
    On some systems it's grub2-install instead of grub-install.
    – ndemou
    Mar 15, 2018 at 13:06

I've done this on quite a few servers over the past while and found issues sometimes, usually what I do is run the following

sudo grub-install /dev/sdb
sudo update-grub /dev/sdb

The problems I've run into are usually displayed with error messages like

update-grub … update-grub failed with no such disk …

To resolve this i've run

sudo mv /boot/grub/device.map /boot/grub/device.map.old 
sudo update-grub 

and this seems to have resolved the issue - as a test in some cases I have removed /sdv/sda and just used /dev/sdb to boot from but this is not ideal and most likely not possible in most production environments!


My experience installing CentOS 5 and CentOS 6 is that during the installation phase I configured the RAID-1 at that time - the installation does give you the choice to do this. What transpired was the following: 1. Defined /dev/sda1 as 1 GB as a RAID partition 2. Defined /dev/sdb1 as 1 GB as a RAID partition 3. Created RAID device /dev/md0 made up of /dev/sda1 and /dev/sdb1 4. Created the /boot partition using /dev/md0 5. Created additional partitions using steps 1 - 3. 6. Implemented LVM on partitions created in step 5 by following instructions.

After the initial system boot, in the grub.conf I altered the entry /dev/sda1 to /dev/md0. I then copied the entry the splashimage line the has (hd0,0) and added a # at the beginning and changed (hd0,0) to (hd1,0). Looking at the above answers showing how to install grub to /dev/sdb follow them. Modify the fstab so that the boot mount point uses /dev/md0 (by doing this, when you do a yum update a there is something updated on the /boot partition it will be written to both /dev/sda1 and /dev/sdb1). If you have a /dev/sda hard drive failure, you would have to boot using the rescue and comment out the (hd0,0) line and uncomment the (hd1,0) line. Your system should be bootable

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.