Setting tunables at time of install

brettw.10

Dabbler
Joined
Mar 5, 2012
Messages
12
Hi all,

I have a system that I have recently installed on a WD 2.5" SSD. After initial boot, I receive warnings that the boot pool is degraded and there are checksum errors when checking the status of the boot pool. This appears to be known issue on some SSDs, and can be avoided (worked around) by setting the loader tunable vfs.zfs.trim.enabled=0 to disable TRIM on the drive. However, this does nothing post-install.

I read here that some people have set the tunable before installing FreeNAS, but I don't know how to do it. I am willing to try this either through GRUB or the FreeBSD bootloader, if someone can help me out with how to set the variable.

Alternatively, does anyone know if setting the tunable in my configuration on 11.1 would result in it being read and used during an upgrade to 11.2, thus resulting in a non-degraded boot pool?

Thanks!
 

pro lamer

Guru
Joined
Feb 16, 2018
Messages
626

gnefarious

Cadet
Joined
Dec 16, 2013
Messages
2
In case anyone is still looking for an answer to this:
At the FreeNAS installer boot prompt, select 3 or O to choose boot options,
Installer-screen-1.jpg

Then at the Options screen, select 6 or Esc to get to the loader prompt
Installer-screen-2.jpg

Then type "set <tunable>=<value>" (in the case of erroring SSDs, set vfs.zfs.trim.enabled=0), then type "boot" to boot.
Installer-screen-3.jpg

You'll need to repeat those steps at 1) first boot and 2) after restoring config db, if that's what you'll be doing.

Note: this is not in any way official, just what worked for me.
 
Joined
Apr 24, 2020
Messages
4
In case anyone is still looking for an answer to this:
At the FreeNAS installer boot prompt, select 3 or O to choose boot options,
View attachment 27728
Then at the Options screen, select 6 or Esc to get to the loader prompt
View attachment 27729
Then type "set <tunable>=<value>" (in the case of erroring SSDs, set vfs.zfs.trim.enabled=0), then type "boot" to boot.
View attachment 27730
You'll need to repeat those steps at 1) first boot and 2) after restoring config db, if that's what you'll be doing.

Note: this is not in any way official, just what worked for me.

gnefarious: I had the exact same issue with a WD 240G M.2 SSD drive I used as boot pool. What you described above worked for me so far.

Thanks a lot for sharing!
 

Hecsall

Dabbler
Joined
Jul 30, 2020
Messages
11
Hi guys, I recently built my first FreeNAS and encountered this same "trim" issue with my WD Green m.2 SSD.
I had a "Boot pool DEGRADED" alert in just 2 hours after my first boot, then I did a fresh install following @gnefarious answer and now I'm at almost 24 hours of uptime without any alert, so thank you, man!

What I was wondering today is: does this set vfs.zfs.trim.enabled=0 option persists between reboots or not? I searched around the internet but I couldn't find any good answer, is there a method to check that?
I also found this FreeBSD doc where at the bottom of the page is said that to disable the SSD trim you can edit /etc/sysctl.conf adding that vfs.zfs.trim.enabled=0 part. Is this a valid way to do this or is it useless?
I'm worried about this because I'm still "exploring" FreeNAS and I'm rebooting it many times, so, for now, I'm repeating the set vfs.zfs.trim.enabled=0 at every boot.

If anyone has some knowledge about this let me know!
 

Samuel Tai

Never underestimate your own stupidity
Moderator
Joined
Apr 24, 2020
Messages
5,399
The correct mechanism for setting this is via System->Tunables. You can create a sysctl tunable with those settings, and that will persist between reboots.
 

Hecsall

Dabbler
Joined
Jul 30, 2020
Messages
11
Thank you very much @Samuel Tai ! I totally missed that section inside the FreeNAS interface.

These settings are WRONG! See my answer below.
I think that how I set this should be correct:
chrome_53D5ZZvAUl.png


For other user's future reference, here is the link of the FreeNAS documentation page talking about Tunables:

Thanks again!
 
Last edited:

Hecsall

Dabbler
Joined
Jul 30, 2020
Messages
11
Quick update, the screen I posted on the answer above is wrong.

The boot drive issue happened again, then I found that inside the FreeNAS shell you can use sysctl vfs.zfs.trim.enabled to check if on your running NAS the trim option is enabled or not, and for me, it printed vfs.zfs.trim.enabled: 1, which is wrong.

The correct, working settings for the Tunable are the following:
ssd trim tunable.png

As you can see, the "Type" wasn't sysctl, but loader.
After doing this, I rebooted the NAS, went into the Shell, typed sysctl vfs.zfs.trim.enabled and the response was finally vfs.zfs.trim.enabled: 0

Hope this helps!
 

Harrisonm65

Dabbler
Joined
Apr 29, 2020
Messages
42
Hi

Sorry to revive this old thread, but Im in a very similar position to you at the moment. Ive had the same TRIM problems, reinstalled disabling the TRIM option under the configure boot options menu and all looked well. A scrub ran last night with 0 errors. However, I have rebooted this morning then run a manual scrub just to make sure all is well and now I have 2 checksum errors on my boot pool.

I am trying to run the sysctl vfs.zfs.trim.enabled you mentioned above in Shell, but all its giving me is "unknown oid 'sysctl vfs.zfs.trim.enabled' Can anyone please confirm the command in Shell to check if TRIM is actually disabled or not. Id rather check this before going down the reinstall route, setting up a tuneable as described above, then finding out TRIM is still causing issues after a reboot.

Thanks in advance.
 
Top