|
NAMEzfsnap —
create and delete rolling ZFS snapshots
SYNOPSIS
DESCRIPTIONzfsnap creates and deletes rolling ZFS snapshots
— usually with cron. zfsnap 's main advantages
are its portability and that all information needed for snapshot management is
kept in the snapshot name itself.
zfsnap snapshots are in the format of pool/fs@[prefix]Timestamp--TimeToLive (e.g. zpool/var@monthly-2010-08-03_02.06.00--1y). 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 OptionsThe majority of functionality is implemented at the <command> layer. However, a few options can be passed tozfsnap directly.
CommandsMostzfsnap 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.
Only one <command> can be passed per
invocation of destroyBy default,zfsnap destroy will
only delete snapshots whose TTLs have expired. However, options are provided
to override that behavior with more aggressive approaches.
Only snapshots created by
recursebackzfsnap 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.
snapshotThe purpose ofzfsnap snapshot
is simple: to create snapshots.
TTL SYNTAXThe Time‐To‐Live (TTL) contains numbers and modifiers. Valid modifiers are:
You do not need to use all of the modifiers, but they must be used in the above order (i.e. sequentially). 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 MathWhen 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. 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. TTL Examples
EXIT STATUSzfsnap exits 0 on success and 1 if an error occurs.
EXAMPLESzfsnap 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 [ Now, for a more complex example. Here,
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 ALSOcron(8), zfs(8), zpool(8)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). AUTHORSzfsnap 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.
COPYRIGHTzfsnap is released under the
“BSD‐3‐Clause License.” See the LICENSE file for
more information.
Visit the GSP FreeBSD Man Page Interface. |