The most up-to-date and accurate documentation is always the zfsnap manpage.

If you have any questions, users and developers are welcome on our mailing list (zfsnap@librelist.com).


A word of warning: by default, zfsnap does not prompt you before it acts. Thus, it is highly recommended that you use the -n (dry-run) flag to make sure the command does what you think it does.

Super Simple

Create a recursive snapshot on pool/fs with a TTL of 6 weeks. Search recursively for any expired snapshots on pool/fs and destroy them.

   # super simple
   zfsnap snapshot -rv -a 6w pool/fs
   zfsnap destroy -rv pool/fs

Two Server Tango

Here, two servers are used: a file server and a backup server. Snapshots are created recursively on pool/fs on the file server. They are then sent to the backup server where they are allowed to expire normally (currently, snapshots are sent manually, but a zfsnap solution is in development). On the file server, all snapshots older than 3 days are destroyed (keeping a few recent snapshots locally makes short-term file recovery quick and easy).

   # two server tango
   backup@filenode:~# zfsnap snapshot -rv -a 13m pool/fs
   # zfs send [etc] | ssh backup@backupnode zfs receive [etc]
   backup@filenode:~# zfsnap destroy -rv -F 3d pool/fs

   backup@backupnode:~# zfsnap destroy -rv pool/fs

Prefix Promenade

Prefixes are quite useful for filtering. Let's try a more contrived example.

  1. Recursively search for and delete expired snapshots on pool/fs with either the prefix 'daily-' or 'weekly-'.
  2. Recursively search for and delete snapshots on pool/fs with either the prefix 'reboot-' or 'hourly-' and are older than 1 day.
  3. Recursively search for and delete all snapshots on pool/fs that have no prefix — regardless of their TTL.
   # prefix promenade
   zfsnap destroy -rv -p 'daily- weekly-' pool/fs \
       -F 1d -p 'reboot- hourly-' pool/fs \
       -PD pool/fs