Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
ZAP(1)			  BSD General Commands Manual			ZAP(1)

NAME
     zap -- maintain and replicate ZFS snapshots

SYNOPSIS
     zap snap|snapshot [-DLSv] TTL [[-r] dataset]...
     zap rep|replicate [-DFLSv]	[[user@]host:parent_dataset [-r] dataset [[-r]
	 dataset]...]
     zap destroy [-Dlsv] [host [,host]...]
     zap -v|-version|--version

DESCRIPTION
     zap automates the management of zfs snapshots.  With a few	simple crontab
     entries, it can be	used to	create a comprehensive zfs backup system.
     There are no configuration	files.	All parameters are supplied on the
     command line or in	zfs properties and all snapshot	information is stored
     in	snapshot names.

     zap plays nice with manually-created snapshots or snapshots from other
     tools.  It	will only operate on snapshots it creates.

     If	the pool is in a DEGRADED state, then snapshots	will still be created,
     replicated, and destroyed unless -D is used.  If the pool is being	resil-
     vered or scrubbed,	then snapshots will still created and replicated, but
     not destroyed.  Use -L, -l, -S, and -s to change this behaviour.

SUBCOMMANDS
   snap|snapshot
     Use the snap subcommand to	create snapshots that will expire after	TTL
     (time to live) has	elapsed.  An expired snapshot will be destroyed	the
     next time zap destroy is run.  TTL	takes the form [0-9]{1,4}[dwmy].  That
     is, one to	four digits followed by	a character to represent the time unit
     (day, week, month,	or year). If datasets are not not supplied on the com-
     mand line,	snapshots will be created for datasets with the	property
     zap:snap set to on.

   rep|replicate
     Use the rep subcommand to replicate datasets.  If a destination and
     datasets are not supplied on the command line, datasets with a destina-
     tion set in the zap:rep user property are replicated.  If the canmount
     property of the local dataset is set to on, after replication an attempt
     is	made to	set canmount to	noauto on the remote side.  This is done to
     prevent mountpoint	collisions.

   destroy
     Use the destroy subcommand	to destroy expired snapshots.  By default,
     only snapshots originating	from the local host are	destroyed.  If a comma
     separated list of hosts are specified, then only destroy snapshots	origi-
     nating from those hosts. Hosts are	specified without any domain informa-
     tion, that	is, as returned	by hostname -s.

OPTIONS
     -D	       Do not operate on snapshots when	the pool is in a DEGRADED
	       state.

     -F	       Supply -F to zfs	receive, which destroys	remote changes that do
	       not exist on the	sending	side.

     -L	       Do not operate on snapshots if the pool has a resilver in
	       progress.  This is the default for the destroy subcommand.

     -l	       Operate on snapshots, even if the pool has a resilver in
	       progress.  This is the default for the snap and rep subcom-
	       mands.

     -S	       Do not operate on snapshots if the pool is being	scrubbed.
	       This is the default for the destroy subcommand.

     -s	       Operate on snapshots, even if the pool is being scrubbed.  This
	       is the default for the snap and rep subcommands.

     -r	       Recursively create or replicate snapshots of all	descendents.

     -v	       Be verbose.

EXAMPLES
     Create snapshots that will	expire after three weeks.

	   zap snap 3w zroot/usr/home/nox zroot/var

     Recursively create	snapshots that will expire after one day.  Be verbose.

	   zap snap -v 1d -r zroot/usr/home

     Create snapshots (recursively for tank and	zroot/var), but	not if the
     pool is in	a DEGRADED state.  The snapshots will expire after three
     weeks.  Be	verbose.

	   zap snap -Dv	3w -r tank -r zroot/var	zroot/usr/home/nox

     Create snapshots for datasets with	the zap:snap property set to on.

	   zap snap 1d
	   zap snap 3w

     Replicate datasets	(recursively for zroot/ROOT) to	the remote host	bravo,
     under the rback/phe dataset.  If you use a	non-default ssh	port, specify
     it	in ~/.ssh/config.

	   zap rep zap@bravo:rback/phe -r zroot/ROOT zroot/usr/home/jrm

     Destroy expired snapshots.	 Be verbose.

	   zap destroy -v

     Destroy expired snapshots that originated on either the host awarnach or
     the host gly. Be verbose.

	   zap destroy -v awarnach,gly

     Automate management of rolling snapshots for datasets with	the zap:snap
     property set and replication for datasets with the	zap:rep	property set
     using these crontab(5) entries.  Taking snapshots is normally cheap, so
     do	it often. Destroying snapshots can thrash disks, so only do it every
     24	hours.

     Note:
     +o	 This example uses the system crontab file, so an extra	who field is
	 included.
     +o	 Appropriate zfs permissions must be set for the zap user.
     +o	 cron(8) must be aware of the full path	to zap,	since the full path is
	 not used in these entries.

	   #minute hour	   mday	   month   wday	   who	   command

	   # take snapshots
	   */5	   *	   *	   *	   *	   zap	   zap snap 1d
	   14	   */4	   *	   *	   *	   zap	   zap snap 1w
	   14	   00	   *	   *	   1	   zap	   zap snap 1m

	   # destroy snapshots
	   44	   04	   *	   *	   *	   root	   zap destroy

	   # replicate datasets
	   54	   */1	   *	   *	   *	   zap	   zap rep

SEE ALSO
     GitHub Page: http://github.com/jehops/zap
     Replication strategy: http://ftfl.ca/blog/2016-12-27-zfs-replication.html
     Related tool: http://www.zfsnap.org/
     crontab(5), zfs(8), zpool(8)

AUTHORS	AND CONTRIBUTORS
     Joseph Mingrone jrm@ftfl.ca
     Tobias Kortkamp t@tobik.me
     David Samms dsamms@nw-ds.com

BUGS
     Issue tracker: http://github.com/jehops/zap/issues

BSD				March 06, 2017				   BSD

NAME | SYNOPSIS | DESCRIPTION | SUBCOMMANDS | OPTIONS | EXAMPLES | SEE ALSO | AUTHORS AND CONTRIBUTORS | BUGS

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=zap&sektion=1&manpath=FreeBSD+12.0-RELEASE+and+Ports>

home | help