Register for the iXsystems Community to get an ad-free experience and exclusive discounts in our eBay Store.

Script to make sure TLER is always enabled on your drives

Western Digital Drives - The Preferred Drives of FreeNAS and TrueNAS CORE

fta

Member
Joined
Apr 6, 2015
Messages
148
Since the HGST NAS drives I just bought don't have TLER enabled by default, I wrote a quick script to enable it on all my drives at boot. To use the script, place it somewhere static and then add it as a preinit command in the init/shutdown scripts. I use it as follows:

Code:
/data/config/bin/set_tler.py 7 7


I put it in /data because my pool is encrypted with a password. The script will iterate through all drives and try to enable TLER. A failure is a no-op.

The scripts are here:
https://github.com/fhriley/freenas_config/blob/master/bin/set_tler.py
https://github.com/fhriley/freenas_config/blob/master/bin/disks.py
 
Last edited:

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526
I like this idea. I've moved it to the guides section. Instead of putting it in /root, I'd put it in /data. /data is one of those safe havens where the upgrade process won't delete stuff that already exists.
 

fta

Member
Joined
Apr 6, 2015
Messages
148
Instead of putting it in /root, I'd put it in /data. /data is one of those safe havens where the upgrade process won't delete stuff that already exists.
Good call, I knew there was a good place, I was brain farting on where it was though. Updated the OP.
 

rosabox

Member
Joined
Jun 8, 2016
Messages
70
I'm trying to use your script but I have a problem.
I've created a directory /mnt/tank called scripts, in it I created the set_tler.py, changed attributes to executable and put this: "/mnt/tank/scripts/set_tler.py 7 7" as a Pre Init command into the Tasks; Init/Shutdown scripts and after a (re)boot TLER is not set.
When i run the script manually /mnt/tank/scripts# ./set_tler.py 7 7 (or ./set_tler.py only)
I get this:
Traceback (most recent call last):
File "./set_tler.py", line 7, in <module>
from disks import get_disks
ImportError: No module named disks

What I'm doing wrong?
 

fta

Member
Joined
Apr 6, 2015
Messages
148
I reorganized the code so I could reuse pieces of it. You'll need one additional file. I updated the OP.
 

hunter

Member
Joined
Nov 24, 2013
Messages
77
FreeBSD newbie here trying to copy your script with the following command:
scp github.com:fhriley/freenas_config/blob/master/bin/set_tler.py /data


And receiving the error message:

Permission denied (publickey).

Any help would be appreciated.
 

fta

Member
Joined
Apr 6, 2015
Messages
148
Click on the link in the OP. On the page that pops up, right click the "raw" button and your browser should give you an option to download the file.
 

diskdiddler

Dedicated Sage
Joined
Jul 9, 2014
Messages
2,162
How does one actually run this script? I literally don't know how to execute it?
 

xterminated

Junior Member
Joined
Dec 26, 2015
Messages
12
Thanks for this great script.
It runs perfectly from a shell, but it doesn't apply if I add it to Init/Shutdown Scripts as a command (post init):

/mnt/tank/usr/scripts/set_tler.py 7 7

the script is not starting. Any idea? Thanks!
I am running Freenas 11.2 stable
 
Last edited:

Fox

Member
Joined
Mar 22, 2014
Messages
50
I'm a little late to this discussion, but thought I would offer my easy solution. My hard drive allows me to set the TELR, but does not hold the setting through a power cycle. I can use the S.M.A.R.T. program included with FreeNas to check and set the values.

On my ancient version of FreeNas (9.3), if you edit each disk in a volume, it has a check box to enable SMART, and the ability to add extra command line settings (Smart Extra Options), so for my drive, I added the following in that field: -l scterc,70,70

For my drives, this turns on the TLER (time limited error recovery)... No script needed.. (Unless my soon to be completed upgrade to 9.10 and then 11.x changes things..
 
Top