Mirroring the FreeNAS USB Boot Device

| Comments

Mirroring the FreeNAS USB Boot Device

One of the things that I like best about FreeNAS is the fact that you have the option to run it off an inexpensive USB flash drive; in fact, that seems to be the preferred option and is the most encouraged by the FreeNAS community. Consequently, that means you have an additional SATA port available for fulfilling the primary function of your NAS—additional storage. Almost as beneficial is the fact that USB drives are quite inexpensive. However, it’s not been unusual for me to receive some incredulous comments, questions, and other reactions when I explain that I entrust my data to an operating system which is hosted on a USB flash drive.

Usually, after listing out the benefits of having the OS on a USB flash drive, most people will come around and appreciate those same benefits. However, a minority of those people are a bit more skeptical, citing reasons like they’ve had bad experience with faulty USB drives in the past or that they simply don’t think that a USB drive can be counted on to be responsible for any kind of operating system.

Typically, what I’ve told the remaining skeptics was that losing your OS drive just isn’t that big of a deal in FreeNAS. In the event that the USB flash drive died, it’d be pretty easy to recover. First you’d need a bootable copy of the FreeNAS installation ISO, a replacement USB flash drive, and a few minutes of your time. FreeNAS would get installed on the new USB drive, then the existing zpool could be imported from the data drives, and finally the system configuration database could be restored from a daily backup that FreeNAS does automatically each morning. As part of an upgrade to my own NAS (a future blog topic), I went through these same exact steps just to see how long it’d take and how difficult it was. From start to finish, it took me about 30 minutes and it was not complicated at all.

Personally, I think 30 minutes of downtime is more than acceptable for the overwhelming majority of builders of DIY NAS machines, but that’s just my opinion. I certainly wouldn’t blame someone for saying that it isn’t acceptable for their own NAS. Thankfully, for people with standards a little bit higher than mine, FreeNAS will make a mirror out of your USB boot device. Even better? It’s really simple to set up. FreeNAS even wrote the exact steps in their user documentation (5.3.1. Mirroring the Boot Device):

How to Mirror the FreeNAS Boot Device

  1. Open your FreeNAS UI in a browser.
  2. From the System tab, select Boot
  3. Click the Status button
  4. Select either freenas-boot or stripe
  5. Click the the Attach button
  6. Select the appropriate device from the Member Disk drop down and click Attach Disk

From this point, the freenas-boot zpool will be converted into a mirror (from a stripe) and the new device will be added to that zpool. Once that action completes, ZFS will begin re-slivering and duplicate your data from your existing USB flash drive to the new one. Because it re-slivers the zpool, you will get a system alert about how the freenas-boot is degraded. However, this is temporary and clears up once the re-sliver is complete. On my machine, that took just a few minutes.

You can create this mirror from the get-go during the installation too. All that you have to do during the installation is to have your two USB drives connected and then to select them both as targets for the installation. The FreeNAS installer will then create your mirrored boot devices as part of its initial setup.


FreeNAS System tab FreeNAS Boot Device Info FreeNAS Boot Device Status FreeNAS Boot Device Status w/ Added Mirror Re-slivering freenas-boot zpool Re-sliver complete on freenas-boot

Gotcha!

The FreeNAS user documentation features this suggestion very prominently:

Note: When adding another boot device, it must be the same size (or larger) as the existing boot device. Different models of USB devices which advertise the same size may not necessarily be the same size. For this reason, it is recommended to use the same model of USB drive.

This warning neither surprised me nor worried me. I’ve been using the SanDisk Cruzer Fit line of USB drives now for years. In fact, before building the DIY NAS: 2016 Edition I even bought a handful of these devices just to have a few extra around the house. When I decided to add a USB Flash Drive mirror on my own NAS, I decided I’d buy a couple more. I had enough USB flash drives from the same manufacturer and of the model that I didn’t think anything of this notice when I made my first attempt. Imagine my surprise when this error message was the result: Error: Failed to attach disk: cannot attach da1p2 to gptid/b2be8286-f11e-a058-00074306bdff: device is too small

Apparently, there have been variations to the 16GB SanDisk Cruzer Fit over time. The drives that I had purchased previously were ever-so-slightly bigger than the ones I bought just this week. How could I work around this? I had a couple options:

  1. Manually back up the system configuration and reinstall FreeNAS while choosing to specify both USB devices. As a result, FreeNAS would size the mirror to the smaller of the two USB drives. Then boot from that new mirrored installation and restore the system configuration.
  2. Dig through my collection of 16GB SanDisk Cruzer Fit drives and try them one by one while hoping that at least one of them is the same size or bigger than the one in my own NAS.

Thankfully, after trying 3—4 different 16GB flash drives, I found one that was the same size or larger.

Final Thoughts

Assuming you’re a bit more meticulous than I have been, you may want some sort of redundancy for your FreeNAS boot device. It’s wonderfully simple to do as part of the initial installation; just insert your two USB flash drives and select them both as destinations for the installation. If you miss it during the initial setup, it’s almost as easy to do through the FreeNAS user interface as is outlined in the user documentation to mirror the boot device. About the only wrinkle is that when doing it after the fact, you need to be careful that the new device is the same size or larger as your existing boot device. The complicated part of this is that you can’t necessarily count on the fact that two different USB drives are the same size, even if they are the same model!

What do you think? Have any of you been holding off because you don’t have much faith in USB flash drives? Does the FreeNAS feature to easily mirror multiple flash drives help with your concerns at all?

Related Posts

Comments