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 (email@example.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.
Create a recursive snapshot on
pool/fs with a TTL of 6 weeks.
Search recursively for any expired snapshots on
# 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
Prefixes are quite useful for filtering. Let's try a more contrived example.
- Recursively search for and delete expired snapshots on
pool/fswith either the prefix 'daily-' or 'weekly-'.
- Recursively search for and delete snapshots on
pool/fswith either the prefix 'reboot-' or 'hourly-' and are older than 1 day.
- Recursively search for and delete all snapshots on
pool/fsthat 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