Github repository for FreeNAS scripts, including disk burnin and rsync support

Github repository for FreeNAS scripts, including disk burnin and rsync support

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
Modifed save_config.sh to support Corral in addition to FreeNAS 9.x
Added two options to the save_config.sh script:
  • Email support: specify your email address to receive a message whenever the script runs
  • ESXi host configuration backup: specify your ESXi server's short hostname and the script will save a copy of its configuration
  • Like
Reactions: SlackerDude
Top