Tutorial 15 · FreeBSD

Backups with ZFS send/receive

Replicate datasets to another pool or host with full and incremental streams, including encrypted raw sends.

Last updated

zfs send turns a snapshot into a stream and zfs receive recreates it elsewhere. Incremental sends transfer only what changed, making them ideal for off-site backups. The examples back up zroot/data to a pool called backup on backup.example.org.

1First, a full copy

zfs snapshot -r zroot/data@bk-2026-10-17
zfs send -R zroot/data@bk-2026-10-17 | zfs receive -u backup/data

-R includes child datasets, snapshots and properties. -u on the receiving side stops the copy being mounted, which avoids it mounting over live paths.

2Over SSH

zfs send -R zroot/data@bk-2026-10-17 | ssh root@backup.example.org zfs receive -u backup/data

For big transfers, mbuffer or pv (both in packages) can smooth and show progress: zfs send ... | pv | ssh ....

3Incremental sends

Next time, take a new snapshot and send only the difference from the last one both sides have. -I includes intermediate snapshots; -i sends just the two endpoints.

zfs snapshot -r zroot/data@bk-2026-10-18
zfs send -R -I @bk-2026-10-17 zroot/data@bk-2026-10-18 | \
  ssh root@backup.example.org zfs receive -u -F backup/data

-F rolls the target back to the last common snapshot first, discarding any changes made there. Keep backup copies read-only to avoid surprises: zfs set readonly=on backup/data.

4Encrypted datasets: raw sends

For a natively encrypted dataset, -w (raw) sends the data still encrypted. The backup host stores it without ever having the key.

zfs send -w -R -I @bk-2026-10-17 zroot/secure@bk-2026-10-18 | \
  ssh root@backup.example.org zfs receive -u backup/secure

5Avoid root on the backup host

Delegate just the permissions needed to an unprivileged user with zfs allow.

# on the backup host
zfs allow -u backupuser create,mount,receive backup/data
# on the source
zfs allow -u backupuser send,snapshot,hold zroot/data

Tools such as zrepl, sanoid/syncoid and zxfer (in packages) automate snapshot rotation and replication once you understand the basics.

6Restoring

ssh root@backup.example.org zfs send -R backup/data@bk-2026-10-18 | zfs receive -u zroot/restored
# or copy single files from the snapshot directory on the backup host

← All FreeBSD tutorials