.TH SNAP 3 .SH NAME snap \- Snaphot Device .SH SYNOPSIS .nf .B bind #ℙ /n/snap .B /n/snap/ctl .B /n/snap/... .SH DESCRIPTION .PP This device provides snapshot functionality layered on top of a file (normally the data file of another device). The active region of the storage space is presented as a data file named by a base name specified when the snapshot space is formatted. Individual snapshots are named by .BR basename.suffix . .PP When the system first comes up, devsnap presents a single file in its name space. The file, .BR ctl , serves the conventional role of providing a control and status interface for the snap device. There are five commands that can be written to the control file: .TP .B bind: The command, .BR bind , is used to attach an existing snapshotted store to the snap device. It takes a single argument which is the data file representing the storage space where snapshots are stored. E.g. .IP .B bind '#ℙ' /n/snap .IP .B echo bind /dev/sdC1/data > /n/snap/ctl .IP Devsnap scans the data file and creates a data file for each snapshot (including the active store) it finds there. .TP .B ream: The .B ream command is used to initially format a storage space where snapshots are to be managed. It takes two arguments, a name given to the active store and the path name of the data file where the snapshots are to be managed. E.g. .IP .B echo ream fs /dev/sdC1/data > /n/snap/ctl .TP .B revert: Reverting takes two arguments, the name of the active region and the name of the snapshot to which we should revert. E.g. .IP .B echo revert fs fs.20131119 > /n/snap/ctl .IP The effect of this command is to roll back the store to the same state it was in at the time that Snapshot .B fs.20131119 was taken. .TP .B snap: Taking a snapshot is triggered by the .B snap command which takes two arguments. The first argument is the name of the active store to be snapshotted, and the second argument is the name to be given to the newly created snapshot. E.g. .IP .B echo snap fs fs.20131119 > /n/snap/ctl .TP .B unbind: The .B unbind command takes a single argument which is the path name for the storage space data file previously connected with a .B ream or .B bind command. E.g. .IP .B echo unbind /dev/sdC1/data > /n/snap/ctl .IP The effect of an .B unbind is the closing of the connection to the underlying device and the removal of the associated files from devsnap's name space. .PP Reads of the .B ctl file return a list of the snapshots and active stores currently known to devsnap. E.g. .IP .B 0 fs /dev/sdC1/data 1 .B 10720 10849 10863 .IP .B 1 fs.20131119 /dev/sdC1/data 3 .B 10683 0 10683 .IP .B 2 fs.201311191 /dev/sdC1/data 3 .B 10720 10683 10849 .PP The items on each line are: the internal slot number, the name of the snapshot, the path name to the underlying data store, the internal flags, the number of blocks in use, and the starting and ending block numbers for that snapshot region. .PP For each snapshot, devsnap provides a data file in its name space. E.g. .IP .B --rw-rw-r-- ℙ ... " 0" ... ctl .IP .B --rw-rw-r-- ℙ ... 1000204886016 ... fs .IP .B --r--r--r-- ℙ ... " 11201937408" ... fs.20131119 .IP .B --r--r--r-- ℙ ... " 11240734720" ... fs.201311191 .PP Note that the snapshots are given read-only permissions, and the active store is given read-write permissions. Also the sizes differ among the data files. The size of the active store is the size of the underlying data file. The size of a snapshot is the number of bytes used by that snapshot. .SH SOURCE .B /sys/src/9/port/devsnap.c