Register for the iXsystems Community to get an ad-free experience and exclusive discounts in our eBay Store.
Github repository for FreeNAS scripts, including disk burnin

Github repository for FreeNAS scripts, including disk burnin

Email was 'broken' for the smart_report.sh and zpool_report.sh scripts on the new FreeNAS 11.3-RELEASE, which it turns out is more fussy than earlier versions were about MIME encoding.

I've modified the code to accommodate the more stringent requirements by adding proper MIME boundaries and have tested on FreeNAS versions 11.2-U8, 11.3-RELEASE, and 11.3-U1.

Please let me know if you have any problems with the updated scripts.
The 'sendmail' command used in several scripts is 'broken' as of FreeNAS version 11.3-RELEASE. I have submitted a bug report and will post here again when/if the bug is fixed and I've modified the GitHub repository.
zpool output changed from FreeNAS version 11.0 to 11.1, breaking our parsing of the scrubErrors and scrubDate variables in the zpool_status.sh script. Added a conditional to check the FreeNAS version and parse these values accordingly.

We obtain the FreeBSD version using uname, as suggested by user Chris Moore here on the FreeNAS forum.

uname -K gives 7-digit OS release and version, e.g.:

Code:
FreeBSD 11.0 --> 1100512
FreeBSD 11.1 --> 1101505
Added a Perl script ( get-system-temps.pl) to my FreeNAS-scripts repository on GitHub. The script provides functionality similar to the get_hdd_temp.sh shell script, including optional support for IPMI.
The title pretty much says it all.

I've posted a new script on GitHub (github.com/Spearfoot/FreeNAS-scripts) named save_config_enc.sh.

It's similar to the older save_config.sh in that its primary function is to copy your configuration file onto your pool. But if you set it up to do so this version goes further and will also:
  • Validate the configuration file with sqlite3 pragma integrity_check;
  • Create a compressed tarball containing the configuration file
  • Encrypt the tarball and email it to you as a MIME-encoded attachment
  • Like
Reactions: SlackerDude
I've added IPMI support to the get_hdd_temp.sh script. When enabled, the script uses IPMI to determine the number of socketed CPUs and reports the current temperature for each of them.

This is particularly handy for those of us who run FreeNAS as a virtual machine, as sysctl always returns a CPU temperature of '-1' in this case.

I also tweaked the drive output to display drive capacity and more extensive family and model information.

Kudos to P. Robar, who made several useful suggestions I've incorporated into this version of the script.

Direct link to the repository: github.com/Spearfoot/FreeNAS-scripts
  • Like
Reactions: SlackerDude
Summary: Forum member @Mugiwara discovered a bug in the disk-burnin.sh script, which was unable to parse the extended test duration for his 8TB disks. I have modified the script to correct this bug.

Details: The bug had to do with the parentheses delimiting the test durations as they are reported by the smartctl command:
Code:
Short self-test routine
recommended polling time:		(   2) minutes.
Extended self-test routine
recommended polling time:		(1242) minutes.

The original code implicitly assumed that whitespace would always precede the integer value; but this isn't true for large drives (>= 8TB), which have very long test durations. I modified the code to remove the parentheses before extracting the integer value:
Code:
# Query the short and extended test duration, in minutes. Use the values to
# calculate how long we should sleep after starting the SMART tests:

Short_Test_Minutes=$(smartctl -c /dev/"$Drive" | pcregrep -M "Short self-test routine.*\n.*recommended polling time:" | sed -e 's/)//;s/(//' | awk '{print $4}' | tr -d '\n')
#printf "Short_Test_Minutes=[%s]\n" ${Short_Test_Minutes}

Extended_Test_Minutes=$(smartctl -c /dev/"$Drive" | pcregrep -M "Extended self-test routine.*\n.*recommended polling time:" | sed -e 's/)//;s/(//' | awk '{print $4}' | tr -d '\n')
#printf "Extended_Test_Minutes=[%s]\n" ${Extended_Test_Minutes}

Nota bene: It will take a very, very long time to burn-in large disks! The 8TB drives described here will take 1,242 minutes - over 20 hours! - just to run the SMART extended test. The badblocks test will take much longer than that to complete.

For large drives such as these, I recommend skipping the extended SMART test before the badblocks test, which you can easily do by commenting out the appropriate line of code as shown here:
Code:
# Run the test sequence:
run_short_test
#run_extended_test
run_badblocks_test
run_short_test
run_extended_test
  • Like
Reactions: SlackerDude
I've discovered that disks don't always report accurate values for the short and extended test duration, often by a large factor. This meant that, in some cases, the burnin script would finish even though the SMART test(s) hadn't run to completion.

I've modified disk-burnin.sh so that it now sleeps for the test duration specified by the disk, after which - instead of blithely assuming the test finished - it then polls the disk, checking for either failure or actual completion of the test before continuing to the next step in the process.
I've posted an updated script with a few formatting changes. It displays the drive temperature, capacity, serial number, and model/family. The CPU temperature output now accomodates systems with 10 or more CPUs.

The output looks like this (note that I'm running FreeNAS as a VM and the actual CPU temperatures aren't available, as shown):
get_hdd_temp_output.jpg
  • Like
Reactions: SlackerDude
Found out I was missing the 'Last Test Age' warning code, which I've added to the smart_report.sh script on GitHub.

This code will display a warning if no SMART tests have been run on the disk in more than a day.
  • Like
Reactions: SlackerDude
Top