Script to make sure TLER is always enabled on your drives

fta

Contributor
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

Contributor
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

Explorer
Joined
Jun 8, 2016
Messages
77
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

Contributor
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

Explorer
Joined
Nov 24, 2013
Messages
94
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

Contributor
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

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

xterminated

Dabbler
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

Explorer
Joined
Mar 22, 2014
Messages
66
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