I use this script to backup a ZFS filesystem used for PostgreSQL and OpenStreetMap data. The script creates a new snapshot with the current date (YYYY-MM-DD), estimates the size between this snapshot and the previous snapshot, then transfers the snapshot to a secondary backup pool using ZFS send. The progress of the transfer is displayed with pv.
This script will not destroy snapshots. It will print out the destroy command if you want to remove the old snapshot from the primary pool to free up space.
This was created for ZFS on Linux; BSD users may have to replace some of the tools.
MIT License
James Badger ([email protected])