Last active
September 6, 2025 14:53
-
-
Save mezhgano/bfc19f4711830af8ace87745ab4192f1 to your computer and use it in GitHub Desktop.
Backup TrueNAS config
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Use exact same file naming as GUI exports | |
| BACKUP_NAME=`hostname -s`-`cat /etc/version | cut -d ' ' -f 1`-`date +%Y%m%d%H%M%S` | |
| # Change to your desired path | |
| BACKUP_LOCATION="/mnt/some_pool/some_dataset/some_folder" | |
| # Include secret seed as well | |
| tar cf "$BACKUP_LOCATION"/$BACKUP_NAME.tar -C /data/ freenas-v1.db pwenc_secret | |
| # Remove backups older than 365 days | |
| find "$BACKUP_LOCATION"/*.tar -mtime +365 -exec rm {} + |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
/root/script/backup_config.shchmod u+x backup_config.shTasks > Cron Jobs > Add
Tested in TrueNAS-13.0-U6.8