ZFSNAP(8)
โจ ZFSNAP(8) โ the zfsnap girlie's guide ๐
okay so bestie, welcome to zfsnap(8), the System Manager's Manual page that's about to become your whole personality. this is the manual for zfsnap, and I'm gonna walk you through every single bit of it, no cap. ๐ซถ
๐ธ NAME ๐ธ
zfsnap โ create and delete rolling ZFS snapshots. that's it, that's the vibe. โจ
๐ SYNOPSIS ๐
zfsnap [-h] [-V] | <command> [options] zpool/filesystem ...
literally that's the whole shape of it. two little top-level flags, or a <command> with its own options and then your pools/filesystems. easy. ๐
๐ฆ DESCRIPTION ๐ฆ
so here's the tea: zfsnap creates and deletes rolling ZFS snapshots โ usually with cron. its main advantages are its portability and the fact that all the info needed for snapshot management is kept in the snapshot name itself. like, the name IS the database. iconic behavior honestly. ๐
zfsnap snapshots are in the format of pool/fs@[prefix]Timestamp--TimeToLive (e.g. zpool/var@monthly-2010-08-03_02.06.00--1y).
breaking that down for you, bestie:
- the prefix is optional and is quite useful for filtering;
- Timestamp is the date and time when the snapshot was created;
- and TimeToLive (TTL) is the amount of time the snapshot will be kept until it's ready for deletion.
โญ Top-level Options โญ
the majority of functionality is implemented at the <command> layer. however, a few options can be passed to zfsnap directly. these are the tiny ones that live at the top:
-hโ print a summary ofzfsnap's command-line options and then exit.-Vโ print the version number and exit.
๐ important vibe check: zfsnap operates only on snapshots and will never destroy or create a pool or filesystem. it's not gonna touch your actual data structures, it just does snapshots. periodt.
๐ Commands ๐
most zfsnap actions are performed by using a <command>. all options and arguments passed to a <command> are operated on as they are read (i.e. sequentially). this provides the flexibility needed for complex scenarios, but also has the capacity to bite you if you're not paying attention. ๐ซฃ remember, -n (dry-run) is provided for a reason. use it. love it. don't skip it.
only one <command> can be passed per invocation of zfsnap.
๐ destroy
by default, zfsnap destroy will only delete snapshots whose TTLs have expired. however, options are provided to override that behavior with more aggressive approaches. (aggressive. we love a confident queen. ๐ฅ)
only snapshots created by zfsnap (or, more specifically, snapshots which match the very specific name pattern it employs) will be considered for deletion. so it's not gonna go deleting random snapshots you made by hand, bestie, it only recognizes its own children. ๐
-Dโ delete allzfsnapsnapshots โ regardless of their TTL expiration โ on all ZFS file systems that follow this option.-Fage โ force delete all snapshots exceeding age (defined in TTL format) โ regardless of their TTL expiration โ on all ZFS file systems that follow this option. see โTTL SYNTAXโ for more information.-hโ print a summary ofdestroy's command-line options and then exit.-nโ dry-run. perform a trial run with no actions actually performed.-pprefix โ enable filtering to only consider snapshots with prefix; it can be specified multiple times to build a list.-Pโ disable filtering for prefixes.-rโ operate recursively for snapshots on all ZFS file systems that follow this option.-Rโ do not operate recursively for snapshots on all ZFS file systems that follow this option.-sโ skip pools that are resilvering.-Sโ skip pools that are scrubbing.-vโ verbose output.
๐ง recurseback
zfsnap recurseback is different from zfs rollback in that it will rollback for not only the specified dataset, but also for all that dataset's children. it's giving "rollback but make it family-sized". ๐
-ddepth โ limit the recursion to depth. a depth of1will rollback only the dataset and its direct children.-fโ typically used with the[-R]option to force an unmount of any clone file systems that are to be destroyed.-hโ print a summary ofrecurseback's command-line options and then exit.-nโ dry-run. perform a trial run with no actions actually performed.-rโ destroy any snapshots and bookmarks more recent than the one specified.-Rโ destroy any snapshots and bookmarks more recent than the one specified, as well as any clones of those snapshots.-vโ verbose output.
๐ snapshot
the purpose of zfsnap snapshot is simple: to create snapshots. that's it. that's the whole job. and she does it beautifully. โจ
-aTTL โ how long the snapshots should be kept. if not declared, the default TTL is one month. see โTTL SYNTAXโ for more information.-hโ print a summary ofsnapshot's command-line options and then exit.-nโ dry-run. perform a trial run with no actions actually performed.-pprefix โ prefix to apply when naming snapshots for all ZFS file systems that follow this option.-Pโ don't apply any prefix when naming snapshots for all ZFS file systems that follow this option.-rโ create recursive snapshots of all ZFS file systems that follow this option.-Rโ create non-recursive snapshots for each ZFS file system that follows this option.-sโ skip pools that are resilvering.-Sโ skip pools that are scrubbing.-vโ verbose output.-zโ round snapshot creation time down to00seconds. she's punctual. โญ
๐ TTL SYNTAX ๐
the Time-To-Live (TTL) contains numbers and modifiers. valid modifiers are:
yโ years (calendar)mโ months (calendar)wโ weeksdโ dayshโ hoursMโ minutessโ secondsforeverโ a special-case modifier that will never expire and cannot be used with other TTL modifiers. both[-F]and[-D]will delete snapshots with a TTL offorever.
you do not need to use all of the modifiers, but they must be used in the above order (i.e. sequentially). so no 5d1y shenanigans, bestie, that's not how this works. ๐
TTL numbers must be greater than zero and cannot have leading zeros (e.g. both 0y and 09d are invalid).
the default TTL is 1m (one month).
๐งฎ TTL Math ๐งฎ
when a TTL is added to a date, each field is added independently, then any month overflows are carried into years, and then all overflows are carried normally from right to left.
for example, with a date of 2009-02-27 and a TTL of 1m3d, the expiration date is 2009-03-30 rather than 2009-04-02. the math is mathing. ๐
as a corner case, adding a TTL of 1m (one month) to the date 2009-10-31 will result in an expiration date of 2009-12-01 rather than 2009-11-30. because there are only 30 days in November, precisely one month after October 31st is ambiguous. the TTL math chooses the more conservative (later) result.
๐ญ yes this is the "what even is a month" problem and yes it's handled. moving on.
๐ TTL Examples ๐
1y6m5d2hโ one year, six months, five days, and two hours18mโ eighteen months90Mโ ninety minutes86400sโ eighty-six thousand and four hundred seconds (1 day)
๐ฅ EXIT STATUS ๐ฅ
zfsnap exits 0 on success and 1 if an error occurs. clean, simple, no drama. ๐ซถ
๐ EXAMPLES ๐
zfsnap was designed to work with cron. thus, some of these examples will include cron markup.
every hour, create recursive snapshots of an entire pool and keep for 5 days.
# Minute Hour Day Month Day Who Command
5 * * * * root /sbin/zfsnap snapshot -a 5d -r zpool
create snapshots of different datasets in different zpools and keep for 2 weeks.
zfsnap snapshot -a 2w zpool2/git zpool2/jails -r zpool2/jails/main zpool1/var
note that [-a], [-r], and [-R] can be used many times in a single line. slay. ๐
now, for a more complex example. here, zfsnap will snapshot:
zpool/varrecursively and hold it for 1 yearzpool/homerecursively and hold it for 6 minuteszpool/usrrecursively and hold it for 3 monthszpool/rootnon-recursively and hold it for 3 months.
zfsnap snapshot -a 1y -r zpool/var -a 6M zpool/home -a 3m zpool/usr -R zpool/root
deleting ZFS snapshots is much slower than creating them, and it's usually not a problem if snapshots live a few hours longer. thus, it is usually best to delete old snapshots once a day.
# Minute Hour Day Month Day Who Command
0 1 * * * root /sbin/zfsnap destroy -r zpool
๐ฆ SEE ALSO ๐ฆ
the zfsnap website is available at http://www.zfsnap.org
please report any bugs to https://github.com/zfsnap/zfsnap/issues
general questions and discussion can be directed to our mailing list at zfsnap@librelist.com (gmane.comp.sysutils.zfsnap on gmane).
๐ AUTHORS ๐
zfsnap was created by Aldis Berjoza, graudeejs@yandex.com, and is co-maintained with Alex Waite Alexqw85@gmail.com. see the AUTHORS file for more information.
๐ COPYRIGHT ๐
zfsnap is released under the "BSD-3-Clause License." see the LICENSE file for more information.
and that's the whole page, bestie!! ๐ซถ this edition came from Debian, dated February 11, 2014, and it lives under ZFSNAP(8) โ go forth and snapshot responsibly, and remember: dry-run first, always. ๐โจ
๐ฆ where this page comes from
- nixos 26.05: zfsnap 2.0.0-beta3
- nixpkgs unstable: zfsnap 2.0.0-beta3
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms