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

FreeBSD Manual Pages

  
 
  

home | help
SNAPSHOT(8)		FreeBSD	System Manager's Manual		   SNAPSHOT(8)

NAME
     snapshot -- UFS/ZFS snapshot management utility

SYNOPSIS
     snapshot [options]	[command] [arguments]

DESCRIPTION
     The snapshot command is a convenience frontend to mount(8)	and
     mdconfig(8) for the management of UFS/ZFS snapshots.  It is also the un-
     derlying tool used	in the periodic	snapshot scheduler
     periodic-snapshot(8) and the mounting/unmouning command in	the amd(8) map
     /etc/amd.map.snap.	 It provides the making, expiring, visiting, mounting
     and unmounting of filesystem snapshots.

     The following global options are available:

     -v	     Display verbose messages showing the essential system commands
	     involved in the operation.

     -h	     Display a short usage help	message	and exit.

     -d	subdir
	     Set the subdirectory on filesystems under which snapshots are
	     placed. The default is the	conventional .snap subdirectory
	     dump(8) uses, too.

     The following commands are	available:

     snapshot list [fs ...]
	     List all existing snapshots on all	filesystems or just the	par-
	     ticular filesystems specified by fs.  The output shows both ac-
	     tual disk-space user usage	("User", "User%") and the disk-space
	     snapshot usage ("Snap", "Snap%").

     snapshot make [-g max-generations]	fs:tag[.generation]
	     Makes a new snapshot generation named tag on filesystem fs, lo-
	     cated in the file fs/subdir/tag.generation.  If the generation
	     part is omitted, generation 0 is used. All	older generations
	     (with numbers greater than	generation) are	rotated	and all	obso-
	     leted generations (with numbers greater or	equal to
	     max-generations) are removed. Keep	in mind	that a maximum total
	     number of 20 snapshots can	be created on a	UFS filesystem only.
	     A max-generations number of 0 effectively deletes all snapshots
	     on	filesystem fs of name tag only.

     snapshot mount [-o	mount-option] fs:tag[.generation] dir
	     Mounts the	fs snapshot tag.generation (or tag.0 if	generation is
	     omitted) under dir	by attaching the snapshot file to the next
	     free md(4)	device and mounting this device	read-only onto the
	     target directory.	If options -o are specified, they are passed-
	     through to	mount(8).

     snapshot umount dir
	     Unmounts a	snapshot by umounting the md(4)	device from dir, deat-
	     taching the snapshot file from the	corresponding md(4) device and
	     deleting the device.

     snapshot visit fs:tag[.generation]
	     This is just a convenience	command	which mounts the specified
	     filesystem	on /mnt, temporarily changes to	/mnt, starts an	inter-
	     active shell there	for inspecting the snapshot content, and upon
	     exit from the shell immediately unmounts the snapshot again.

EXAMPLE
     The following sample session illustrates the making, rotation, mounting,
     unmounting	and removal of snapshots:

	   root# snapshot list /var
	   Filesystem	       User   User%	Snap   Snap%  Snapshot
	   root# snapshot make -g4 /var:test
	   root# snapshot list /var
	   Filesystem	       User   User%	Snap   Snap%  Snapshot
	   /var		     1172MB   14.8%	 4MB	0.1%  test.0
	   root# snapshot make -g4 /var:test
	   root# snapshot list /var
	   Filesystem	       User   User%	Snap   Snap%  Snapshot
	   /var		     1176MB   14.8%	 4MB	0.1%  test.0
	   /var		     1176MB   14.8%	 4MB	0.1%  test.1
	   root# snapshot make -g4 /var:test
	   root# snapshot list /var
	   Filesystem	       User   User%	Snap   Snap%  Snapshot
	   /var		     1181MB   14.9%	 4MB	0.1%  test.0
	   /var		     1181MB   14.9%	 4MB	0.1%  test.1
	   /var		     1181MB   14.9%	 4MB	0.1%  test.2
	   root# snapshot make -g4 /var:test
	   root# snapshot list /var
	   Filesystem	       User   User%	Snap   Snap%  Snapshot
	   /var		     1186MB   15.0%	 4MB	0.1%  test.0
	   /var		     1186MB   15.0%	 4MB	0.1%  test.1
	   /var		     1186MB   15.0%	 4MB	0.1%  test.2
	   /var		     1186MB   15.0%	 4MB	0.1%  test.3
	   root# snapshot make -g4 /var:test
	   root# snapshot list /var
	   Filesystem	       User   User%	Snap   Snap%  Snapshot
	   /var		     1186MB   15.0%	 4MB	0.1%  test.0
	   /var		     1186MB   15.0%	 4MB	0.1%  test.1
	   /var		     1186MB   15.0%	 4MB	0.1%  test.2
	   /var		     1186MB   15.0%	 4MB	0.1%  test.3
	   root# snapshot mount	/var:test.2 /mnt
	   root# ls /mnt
	   account    cron	 heimdal    mail       opkg	  spool
	   at	      db	 lib	    msgs       preserve	  tmp
	   backups    empty	 log	    named      run	  yp
	   root# snapshot umount /mnt
	   root# snapshot make -g0 /var:test
	   root# snapshot list /var
	   Filesystem	       User   User%	Snap   Snap%  Snapshot
	   root# _

     By	using an amd(8)	map /usr/local/etc/amd.map.snap	containing

	   /defaults type:=program
	   *	     mount:="/usr/local/sbin/snapshot snapshot mount /${key} ${fs}";\
		     unmount:="/usr/local/sbin/snapshot	snapshot umount	${fs}"

     and a /etc/rc.conf	configuration of

	   amd_enable="YES"
	   amd_flags="-a /.am -c 1800 -w 60 -l syslog /snap /usr/local/etc/amd.map.snap"

     even non-privileged users can access arbitrary snapshots
     fs:tag[generation]	by just	accessing /snap/fs:tag[generation].  For in-
     stance, if	a snapshot hourly.2 exists on filesystem /var one can then ac-
     cess an old state of file /var/tmp/foo.txt	by simply accessing the	path
     /snap/var:hourly.2/tmp/foo.txt.

SEE ALSO
     mount(8), mdconfig(8), md(4), periodic-snapshot(8),
     http://people.freebsd.org/~rse/snapshot/.

HISTORY
     The snapshot utility first	appeared in FreeBSD.

AUTHORS
     Ralf S. Engelschall <rse@FreeBSD.org>

FreeBSD	13.0		       September 3, 2004		  FreeBSD 13.0

NAME | SYNOPSIS | DESCRIPTION | EXAMPLE | SEE ALSO | HISTORY | AUTHORS

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

home | help