Larger single boot devices, use "copies=2"?

We are starting to see boot device issues, or boot failures due to failed blocks. (And of course, actual failed devices, but that is simple, “must replace”.)

Today, it is pretty hard to find a new, yet inexpensive but reasonable quality 16GB or 32GB SATA SSD or NVMe. So people have resorted to using 64GB or 120/128GB sized storage, or larger. (But then want to “share” it with Apps or something… not going their in this thread.)

So what about using “copies=2” on single boot device?

The benefits are similar to Mirrored boot storage, bad block protection. But, of course completely failed storage devices would still cause failed boots and then “must replace” boot device. The cons are slightly slower writes because each block must be written twice to the same device, (or thrice for critical metadata). And another con is the longer boot storage scrub. I would not think those would be any real problem.

Of course if this becomes a “thing” people want, a feature request should be put in. This is the pre-feature request discussion thread.


If we don’t have “official” support, can we still get this to work?

Well, I would think that a change to the boot pool’s top level dataset of “copies=2” would impact all future writes. Including the next TrueNAS update. Previously written files, (from older boot environments), would still have 1 copy (the default), and not take up double the space. Yet with larger SATA SSDs or NVMes, even 4 or 5 updates could be be stored using 2 copies.

A quick check on my test SCALE VM seems to indicate this would work. But, there is no update available, yet :frowning:


What do you think?

Obviously not everyone would want to bother. And some might go for real Mirroring of the boot pool.

3 Likes

16 GB Optane M10 NVMe are plentiful on eBay, and really cheap. There are even some 32 GB.

For anything larger than 100 GB, a “copies=2” checkbox in the installer would be an interesting option, and hopefully not too complicated to implement.

Apparently someone wanted to implement this prior to any official support. So here it is:

  1. Log into your TrueNAS SCALE server as user “root”
  2. Run the following command:
        zfs set copies=2 boot-pool
  3. Exit out of the server
        exit
  4. Next TrueNAS SCALE update will take twice as much space, and be redundant on the same drive

As stated in the original post, this will not protect against complete boot device failures.

3 Likes

Sounds like a good idea to me.

1 Like

This Is for sure and 100% a gold tip, truenas use case are so many… Unlucky don’t fit mine.
But if a request will be made for sure will have my vote

So I’ve just done this (thank you for the instructions, extremely clear and concise). Will this only apply to future files, or will Truenas no “double up” the old files as well?

You are welcome.

Correct, only future files. This will NOT cause any existing file to be “doubled up”.

Generally, you want to perform an update immediately after to make it effective.

Technically, any new write will be doubled up. So, new log file entries, configuration updates and such will include 2 copies. But, their is no certainty on how much of such files will be “doubled up”. Well, I mean their is 100% certainty that existing blocks of old files will remain single copy. And newly written blocks of old files will have 2 copies. It is just that from normal OS tools you can’t easily determine how much of a file’s blocks are 2 copies verses 1 copy.

1 Like

Gee, I wonder if the 2 open source firewall products that use FreeBSD & OpenZFS, (pfSense & OPNsense), can also be made to use “copies=2”?

Have I discovered a real, practical use for “copies=2”?
Embedded uses, like smaller NAS & firewalls?
That have only 1 boot device?

2 Likes

:wink:

1 Like

I got a thrill to see that @copies-2 is still active.

1 Like

Ewww. Posts in ‘General’ but makes SCALE-specific comments. What’s happened to you?

Works on CORE too, but you might have a bigger problem waiting for an update. :slight_smile:

I figure (I have not tried this myself) that once you run the commands @Arwen has stated, all you need to do is make a backup of your TrueNAS configuration like all people do (hint hint), “Clone” your boot environment, make it active, and delete your old boot environment. You could do that for older boot environments but I personally would only do the current boot environment.

It depends on what you mean by “Clone”.

If you mean ZFS clone, then no, it will not work to make 2 copies. This is because any file in the clone, that is in the shared snapshot, will retain 1 copy. Even "promote"ing the ZFS clone of the boot-pool won’t change any existing file.

On the other hand, if one were to ZFS snapshot the current boot environment, ZFS send / receive it to another name in the boot-pool, altering it as appropriate and last, create a Grub entry. That might work. But, it is too much work.

Easier to:

  1. Backup configuration, (and any ZFS encryption keys)
  2. Re-install TrueNAS, (Core or SCALE), to 1 prior version to what you want
  3. Only add networking and root password configuration
  4. Set “copies=2”
  5. Perform the update to the TrueNAS version you want
  6. Restore the configuration

That is a lot more work than waiting for the next update, (at least for SCALE).


On the subject of targeting SCALE, verses generic TrueNAS, yes, I was aware that updates to Core are less likely now. Plus, I don't remember if Core uses the same name for the "boot-pool". Just checked now, and yes, Core also uses "boot-pool".
1 Like

I was talking about the “Clone” option in the boot environment. But if that is not possible to achieve the end result, I do like just starting over.

I am redoing my NVMe NAS today, got a 5Gbps NIC, yanked one of the NVMe drives out, going to “try” to do this one by the book, meaning setting up permissions correctly. I will likely screw it up, but I can try. Homework for me to do. My NAS is not exposed to the internet so using root has always worked great for me, but time to get on the band wagon and do things correctly “for a home user”.

1 Like

I checked & tested the “clone” function in the TrueNAS SCALE GUI. It does do a ZFS snapshot and ZFS clone. So it will not double up files, (aka “copies=2” is not applied to existing files).

This of course makes sense. You have a boot environment that you plan on changing. So you create a clone of it, and either boot the clone to make the changes. Or consider the clone a back out plan.

1 Like

I set this on my boot pool years ago when I switched from a USB stick to a (severely underused) 256 GB SSD. I figured, might as well use some of that space.

I haven’t noticed any benefit or protection, but I also haven’t seen any issues.

An official setting for this would be a nice feature.

zpool history to the rescue.

2017-01-11.21:04:11 zpool create ...
...
2017-01-11.21:32:32 zfs set copies=2 freenas-boot

Yes, I should recreate the boot-pool at some point, but nothing is outwardly broken right now, so…

4 Likes

seems a nice idea for smaller systems!