System Backup (ZFS)



Reaction score: 1
Messages: 34

Im I'm putting together a script to backup my server. I have two backup disks that will be rotated weekly.

Does anyone know with ZFS, can I update the backup with the differences and not create separate diffs? Or would this mean copying the entire data?

As Im I'm backing up to a pool directly, Im I'm not sure how to store the incremental backups nor am I keen on adding any kind of complexity.

I would like to backup at 3am each night for a week, then switch backup disk with one stored at another location, and repeat...

Any tips or help would be appreciated :)


1. Check to see if a backup device is present. Probe /dev/da0.
2. Check capacity to see if the device is an external hard disk larger than 1TB.
3. Dump the databases to ZFS Data filesystem using mysqldump.
4. Copy the BSD configuration files to ZFS Data filesystems.
5. Attach the encrypted disk.
6. Import the ZPool.
7. Create a snapshot of the latest data.
8. Send the data to the backup device.
9. Export the ZPool.
10. Detach the encrypted disk.

Script (not finished...):

mysqldump -ubackup -ppassword --all-databases --all-tablespace > /data/temp/backup.sql

geli attach -k /user/local/backup/da0.key /dev/da0
zpool import backup2

zfs snapshot data/docs@1
zfs snapshot data/pics@1
zfs snapshot data/temp@1

zfs send data/docs@1 | zfs recv backup2/docs
zfs send data/pics@1 | zfs recv backup2/pics
zfs send data/temp@1 | zfs recv backup2/temp

zfs destroy data/docs@1
zfs destroy data/pics@1
zfs destroy data/temp@1

zfs umount backup2/docs
zfs umount backup2/pics
zfs umount backup2/temp

zpool export backup2
geli detach da0.eli

Run a backup every morning at 3AM:
* 3 * * * backup /usr/local/backup/