SOLVED: Easy method to autosave your config file with or without secret seed

I used:

cli -c 'system config save configsave={"secretseed":true, "root_authorized_keys":true} >/mnt/main/backups/config/truenas/truenas_config_'`date +"%y-%m-%d_%H"`.tar

which I run as a cron task as admin

This way, if I crash, I can recover my most recent config.

You can edit out the configsave argument if you are worried about security.

I have an offline config that I can restore from which gets all my pools back, then I can simply restore the latest config from the pool.


Nice tidbit of information.

1 Like

Alternatively, I wonder if you can send it as an email attachment, rather than save it to a local path?

I don’t have SCALE, but I would assume this is a matter of piping the output of the cli portion to the mail or mailx command? But it is possible to pipe a tar file to the “attachment” argument? (Bonus points to retaining the datestamp in the filename.)

Probably the incorrect way, but this is what I had been doing. Probably should update it to use the method prescribed above.


FILENAME="`hostname -s`-`cut -d' ' -f1 /etc/version`-`date +%Y%m%d`.tar"


tar -cvlf /mnt/data/xxxx/Software/truenas/$FILENAME --strip-components=2 \
/data/freenas-v1.db \
/data/pwenc_secret \
/root/.ssh \
/boot/device.hints \

echo "Backup $FILENAME created"

find /mnt/data/xxxx/Software/truenas/NAS-?-TrueNAS-*.tar -mtime +365 -exec rm {} \;

Where is it saving this config file?

*edit, I figured it out. Thanks!
Now I just have a cloud sync job to store those config files.

don’t really need to do that because I have a config file for when I set up the pools so i can always use that and then access the latest config file inside the pool and upload that.