Email Your TrueNAS Configuration Files to Yourself

For quite a long time we have seen people asking how to save their TrueNAS configuration files, typically after they had to recover from a major failure.

The answer to making a backup of those configuration files is easy, follow the TrueNAS manual and use the GUI to download a copy to your local computer. Pretty easy, right.

But it doesn’t stop there…
You have different kinds of people who would benefit from a fully automated email generating TrueNAS backup file taring script.

  1. The new user who has not read the TrueNAS documentation AND had a major failure AND did not have those handy configuration files. Oops!.
  2. The Home User (like me) who occasionally makes configuration changes and would enjoy some automation to ensure you always have the most recent several months of configuration files sitting in email for the day the files are needed. Yes, those days happen.
  3. The System Administrator who makes changes daily and these configuration files are critical to maintain, plus Sys Admins are busy, lets automate something to make life easier.

Why is this available now?

For many years we have recommended the use of Multi-Report to send an email that besides a nice graphical chart full of drive failure data, it also includes your configuration files. By default it sends an email with a configuration backup once a week on Mondays, and of course that schedule can be customized by the end user.

For those folks who would rather not go through the 10 minutes of setup configuring Multi-Report, they can use this very short and specific script I have linked in my GitHub account called truenas_config_backup.txt (you rename to truenas_config_backup.sh).

This script found it’s origins buried deep inside Multi-Report.

Both the GitHub README.md file and the script have detailed instructions on how to setup and use the script.The script has instructions at the beginning, tells you about the one line that must be changed and two other lines that can be changed.

Like Multi-Report, you need a privileged account to access the two files we need to copy. If you do not have the privileges, the script will simply fail, nothing bad happens.

To automate the entire thing, setup a CRON Job to run the script on the schedule you desire.

Besides generating an email, you can also have the script copy the backup file to a location on your computer. The files are dated by day/month/year so you can keep one a day stored somewhere. I would recommend you move a copy off of your TrueNAS system, unless it is replicated to a backup.

I really hope this small script helps many people. And as always, if you find a problem, toss me an email at joeschmuck2023@hotmail.com or send me a message on these forums.

And please, please, no money. I can’t accept cash, it could void my Social Security payments if I get too much money. I would however like a new truck, just sayin’ :rofl:

2 Likes