Skip to content

Common snapshots and holds

DatuX edited this page Apr 28, 2022 · 10 revisions

Common snapshots and holds

image

If you're new to ZFS these terms can be quite confusing. Whats going on?

Common snapshots

ZFS can do incremental transfers via snapshots. It does this very efficiently by sending over the differences between two snapshots.

There are a few rules for ZFS however:

  • The same starting snapshot has to exist on both target and source. So its a common snapshot.
  • There cant be any newer snapshots on the target. (Normally should not happen, otherwise use --destroy-incompatible)
  • Encryption has to be compatible (See Encryption)

If there is no snapshot in common, the only way to continue is to destroy all the whole dataset (and all its snapshots) on the target and start from a full backup.

Holds to the rescue

To prevent accidental deletion of the common snapshot zfs-autobackup uses holds.

This can be quite frustrating for new users who try to delete old datasets that still have holds. (Dataset is busy) Use zfs holds and zfs release to release a snapshot.

If you know what you're doing you can use --no-holds.

Holds and offline backups

Normally when you split up the snapshotting part and backupping part you would do it like this: https://github.com/psy0rz/zfs_autobackup/wiki#splitting-up-snapshot-and-backup-job

The snapshotter will still connect to the target server and figure out the common snapshot so that they wont be destroyed. It can also cleanup old snapshots from the source if it sees that target doesn't need them (anymore)

However, if you have an offline backup (e.g. a USB disk that you sometimes connect), you are force to use the snapshot-only tool. You would just run zfs-autobackup without specifying a target dataset or ssh-target.

In this case the holds are more important: Now the tool looks at the holds to see which snapshots are common. Otherwise it might accidentally destroy them if you have a tight --keep-source schedule.