0

I have Centos 6.7 running on 2 SSD disk in RAID1.
The boot loader is installed only on /dev/sdb so in case it fails I won't be able to boot the system from /dev/sda

Is there a safe way to configure both drives in a way that system can boot from any of them in case one of them fails ?
And of course, to keep the current data intact on them.

  • if you are only booting from one of the disks then you have not configured RAID at all – Sum1sAdmin May 24 '16 at 10:47
  • @Sum1sAdmin no, that's fine on software raid. The bootloader is static, so it's not automatically synced except when updating the software. The /boot should be raided, but the "bootcode" (installed via grub-install /dev/sda etc.) should not be. – Peter May 26 '16 at 11:11
0

This depends on how the RAID is achieved. If it is a software raid, then the disks are actually not perfect copies of each other - only the partitions are mirrored, but not the bootloader.

The solution is to install the bootloader on the second drive. This can be done during runtime and should be safe. It will go something like this (assuming /dev/sdb is your second drive):

grub
device (hd0) /dev/sdb
root (hd0,0)
setup (hd0)
quit

The important part is this:

device (hd0) /dev/sdb

It tells the bootloader sdb is the first drive of your system, which is true only if the other drive failed. But since the bootloader of the second drive will only ever be executed if exactly that happens, it works.

  • This is right (except that it looks like grub-legacy), but remember that if the first disk is defective but the system thinks it's fine and attempts to boot, it may still fail. In that case you simply don't reboot (raid is for preventing unplanned downtime, not making things magically work exactly as normal), or if you must reboot, pop the disk(reliable...but test to be sure) or use the boot selector to choose the other disk (not reliable on old desktops and grub-legacy... not sure today). – Peter May 26 '16 at 11:14

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.