Skip to content

Lesson 6 of 9 · 25m

Snapshots, Clones, and ZFS Send as Operational Primitives

Use snapshots for rollback windows, clones for safe experimentation, and zfs send/receive for efficient replication without confusing copies with backups.

Snapshots are the feature everyone demos and few people operate well. A ZFS snapshot is a point-in-time reference to blocks in a dataset. It is cheap at first because blocks are shared. It becomes expensive when the live dataset changes and the snapshot pins old blocks. That cost is not a flaw; it is the invoice for retention.

Snapshots are deletion-resistant history

Create and inspect them explicitly:

zfs snapshot tank/data@before-upgrade
zfs list -t snapshot -o name,used,refer,creation -r tank/data
zfs rollback tank/data@before-upgrade

The used column is the space uniquely referenced by that snapshot. refer is the space referenced by the snapshot filesystem view. Deleting files from the live dataset does not free blocks still referenced by a snapshot. This confuses operators who think deletion should immediately restore free space.

Automate retention deliberately

A sane policy separates frequency from retention:

hourly   keep 24
daily    keep 14
weekly   keep 8
monthly  keep 12

Many sites use sanoid or zfs-auto-snapshot rather than hand-written cron loops. Whatever the tooling, alert on snapshot creation failure. Replication succeeding yesterday is not proof that snapshots exist today.

Clones are writable forks

A clone starts as a writable snapshot with shared blocks (zfs clone tank/data@before-upgrade tank/data-upgrade-test). Clones are ideal for testing migrations against realistic data without copying terabytes. Remember the dependency: the clone depends on its origin snapshot until it is promoted or the relationship is otherwise resolved. Use clones for experiments, not as an undocumented permanent copy of production.

send and receive move snapshots efficiently

Replication sends snapshot streams, including incremental differences:

zfs snapshot tank/data@repl-2026-11-30
zfs send tank/data@repl-2026-11-30 | ssh backuphost   'zfs receive backup/tank-data'

Incremental replication uses common snapshots:

zfs send -i tank/data@repl-2026-11-29 tank/data@repl-2026-11-30   | ssh backuphost 'zfs receive backup/tank-data'

Tools such as syncoid wrap this logic safely, but you should understand the primitive. If the common snapshot disappears on either side, incrementals fail. Resumable receives, raw encrypted sends, and hold tags matter in larger environments.

Snapshots are not off-site backups

Snapshots protect against deletion and corruption only while the pool and its failure domain survive. Replicated snapshots are stronger, especially on an independent host, but replication can faithfully copy encrypted or corrupted production state if nobody notices upstream damage. Pair replication with immutable retention or delayed replication when ransomware is in scope.

Field notes

  • Put holds on snapshots used as replication bookmarks when automation might otherwise prune them.
  • Test zfs receive into a fresh pool occasionally; send success alone does not prove receive compatibility.
  • Destroying snapshots recursively can free enormous space and enormous confusion; review list output first.
  • Snapshot names are operational metadata. Use timestamps and purpose labels consistently.
  • Do not snapshot every dataset at the same minute on busy systems if coordinated I/O storms become visible.

Was this lesson helpful?

Sign in to rate