GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  SNAPSHOT (8)

NAME

snapshot - UFS/ZFS snapshot management utility

CONTENTS

Synopsis
Description
Example
See Also
History
Authors

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 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:
-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:
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%").
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.
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).
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.
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.

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 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.

SEE ALSO

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

HISTORY

The snapshot utility first appeared in
.Fx .

AUTHORS


.An Ralf S. Engelschall Aq rse@FreeBSD.org
Search for    or go to Top of page |  Section 8 |  Main Index


Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.