snapshot -- UFS/ZFS snapshot management utility
snapshot [options] [command] [arguments]
The snapshot command is a convenience frontend to mount(8) and mdconfig(8) for the management of UFS/ZFS snapshots. It is also the underlying 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:
The following commands are available:
snapshot list [fs ...]
List all existing snapshots on all filesystems or just the particular filesystems specified by fs. The output shows both actual 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, located 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 obsoleted 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 passedthrough to mount(8) .
snapshot umount dir
Unmounts a snapshot by umounting the md(4) device from dir, deattaching 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 interactive shell there for inspecting the snapshot content, and upon exit from the shell immediately unmounts the snapshot again.
The following sample session illustrates the making, rotation, mounting, unmounting and removal of snapshots:
root# snapshot list /var
By using an amd(8) map /etc/amd.map.snap containing
and a /etc/rc.conf configuration of
amd_flags="-a /.am -c 1800 -w 60 -l syslog /snap /etc/amd.map.snap"
even non-privileged users can access arbitrary snapshots fs:tag[generation] by just accessing /snap/fs:tag[generation]. For instance, if a snapshot hourly.2 exists on filesystem /var one can then access an old state of file /var/tmp/foo.txt by simply accessing the path /snap/var:hourly.2/tmp/foo.txt.
mount(8) , mdconfig(8) , md(4) , periodic-snapshot(8) , http://people.freebsd.org/~rse/snapshot/.
The snapshot utility first appeared in FreeBSD.
Ralf S. Engelschall <rse@FreeBSD.org>
Table of Contents