EFI Boot: Two independently bootable physical hard drives?

My computer has two physical hard drives.

  • sdd internal hdd0
  • hdd internal hdd1

The BIOS (EFI) allows the boot either one.

Since I never know when one hdd, especially the ssd, stops working, I would prefer to have backup operating system on the second hard drive. Ideally that second hdd is bootable without requiring anything from the first hdd. (I mean, I want to use the BIOS as the boot manager and not involve grub on hdd0.)

I would like to have Debian Wheezy installed on both hdds.

I don't use Windows at all.

One thing that might work is physically removing hdd0, but I'd prefer not physically removing any hdds to avoid voiding warranty.

Installing Debian on hdd0 was simple. It created an EFI boot partition, boot partition and root partition. Installing Debian on hdd1 didn't work so well. It only created a boot partition and there was no option to install grub on hdd1, only on hdd0.

I booted from hdd0, set the bootable flag for /dev/sdb1 in gparted and used "sudo grub-install /dev/sdb" (and also tried /dev/sdb1) but that didn't make that hdd bootable.

Long story short, how can I have two independently bootable hdds?


Solution 1:

First, you must be very clear about whether you're booting in BIOS/CSM/legacy mode or in EFI/UEFI mode. Mixing boot modes is also possible on most computers, but greatly complicates matters in most cases, so I recommend strongly against a mixed-mode setup. Your description is not entirely clear, but it sounds like you're using EFI-mode booting. Running the Boot Info Script, posting the RESULTS.txt file that it generates to a pastebin site, and posting the URL for the document here would clarify matters.

Assuming you're doing an EFI-mode boot, I recommend you read a bit to understand the EFI boot process. Two documents I've written may help:

  • My Linux EFI-mode installation page is a general tutorial on EFI-mode installation. It won't directly answer your questions, but it provides some basic information that should help you understand what's going on.
  • My EFI Boot Loaders for Linux page covers EFI boot loaders for Linux. Its Basic Principles sub-page is particularly relevant to building an understanding.

Basically, you want to create a separate EFI System Partition (ESP) on each disk and set up boot managers and/or boot loaders on both of those ESPs. Given your needs, my rEFInd might be a good choice because it builds its OS list at boot time, so it will omit loaders for any OS on a disk that's become unavailable. You could use something else, though, and just ignore entries that you know will be non-functional.

One caveat: EFIs have their own boot managers, which maintain a list of boot entries in NVRAM. Some EFIs will "helpfully" remove boot entries that are invalid. The result is that boot entries for a disk that you've removed may disappear permanently, necessitating adding them back. This can be very annoying in some cases. The usual solution is to put a boot manager in the fallback position (EFI/BOOT/bootx64.efi on the ESP). Most EFIs will recognize this and give you an option to boot it.