Backup-script for TrueNas

As described in the previous post, i modified the awesome script from Jörg Binnewald @ https://esc-now.de/ to suit my needs.

The script is automatically triggered, when the backup-HDD is attached to the TrueNAS-Server. The Datasets (and child-Datasets) are incrementally backed-up via send/receive (ZFS feature).

The source code can be found here:
script: https://github.com/dapuru/zfsbackup

A devd-rule (can also be found at the location above) triggers the Pool-Backup script, when the Backup USB HDD is attached. A workaround for TrueNAS killing my devd-rule on reboot (no time and interest to look into that further, so just copying the rule from a backup place on reboot.

Restore Backup
1) Import the Backup-Pool
zpool import backpool

2) Get List of available backups
zfs list -rt snap -o name,creation backup

3) Retrieve Backup of a selected Dataset
zfs send -R backpool/dataset@snapshot | zfs recv -vF targetpool/dataset

4) Scrub
zpool scrub targetpool

5) Export Backup-Pool
zpool export backpool

Get a specific File from backup or Browse the backup

1) Import Backup-Pool
sudo zpool import -o readonly=on -o altroot=/mnt/backup backpool

2) Export Backup-Pool
zpool export backpool

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.