Mirrored Boot Drives on FreeNAS


Creating a mirrored boot device in FreeNAS is well documented. I’d personally encourage and recommend having redundant boot devices on home or small business FreeNAS system for a couple of reasons:

  1. As the FreeNAS operating system typically resides on low-cost USB sticks, mirroring FreeNAS boot drives is inexpensive; and
  2. It eliminates the boot device being the single point of failure on a FreeNAS server.

Overnight, the state of a mirrored boot set on one of my FreeNAS servers (running build 9.10.2-U4) changed from HEALTHY to DEGRADED as the primary boot devices in the mirrored set began to log a large number of errors. So I replaced the faulty boot device, resilvered the replacement and rebooted the FreeNAS server. To my horror, the server failed to boot. The message on the console read ‘This is a NAS data disk and cannot boot system. System halted.’

I had (incorrectly) assumed that, by having mirrored boot devices, the level of redundancy would allow the FreeNAS system to self-heal. I had never actually previously tested it though. A search through the forums revealed the missing piece of the puzzle. It turns out that the boot sector of the primary boot device was not mirrored on the secondary device. To work around this, after creating a mirrored boot set, I executed the following command line from the Shell to make the secondary device bootable.

grub-install /dev/<secondary_boot_device>

The name of the secondary boot device can be deduced from the FreeNAS GUI boot status screen.

Sketch - Boot Status

From this screenshot, the boot partition names of the boot devices on this particular system are da0p2 and da1p2. The corresponding boot device names are da0 and da1. I’ve ascertained that da0 is the primary device and da1 the secondary device on this system. To make the secondary device bootable, I executed the following command:

grub-install /dev/da1

It is crucial that the command is executed on the device and not the device partition name listed in the boot status screen. A screenshot displaying the output of the command is shown below.

Sketch - grub-install

It is imperative that you make the secondary boot device bootable as soon as you’ve created the mirrored boot set. You won’t have the opportunity to do so if your primary boot device were to catastrophically fail.

Edit: This issue appears to have been fixed as advised here. However, I’ve left this post in in case there is a regression. The only way to be sure that the mirror is working is to test it by shutting down the FreeNAS server, removing the primary boot device, and rebooting with the secondary boot device. Test at least once a year or after any significant FreeNAS upgrade.

References

  1. Mirroring the Boot Device
  2. Only one of two mirrored USB Drives is booting
  3. Install GRUB after mirrored boot drive via GUI?
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s