initial checkin; mostly complete
[distorted-backup] / snap.8.in
CommitLineData
99248ed2
MW
1.TH snap 8 "6 November 2011" "distorted.org.uk backup"
2.SH NAME
3snap \- create and remove snapshot devices
4.SH SYNOPSIS
5.B snap
6.RB [ \-u ]
7.RB [ \-c
8.IR file ]
9.I device
10.RI [ key \c
11.BI = value
12\&...]
13.SH DESCRIPTION
14The
15.B snap
16utility manages device-level snapshots in a mechanism-independent way.
17It's intended to be used as part of automated filesystem maintenance
18activities, such as backups or online filesystem checking.
19.PP
20The command line options are as follows.
21.TP
22.B "\-h, \-\-help"
23Print a help message to standard output and exit with status zero.
24.TP
25.B "\-v, \-\-version"
26Print the program's version number to standard output and exit with
27status zero.
28.TP
29.BI "\-c, \-\-config-file=" file
30Read configuration from
31.I
32file
33rather than
34.BR @sysconfdir@/snaptab .
35.TP
36.B "\-u, \-\-unsnap"
37Remove a snapshot, rather than creating a new one. Strictly speaking,
38this just passes the option
39.B op=unsnap
40to the handler, though the conventional interpretation is to remove the
41snapshot.
42.SS Operation
43An
44.B op
45option is synthesized from the command-line options. Specifically, if the
46.B \-u
47as given, then
48.B op=unsnap
49is set; otherwise
50.B op=snap
51is assumed.
52.PP
53The
54.B snap
55program looks up the
56.I device
57in the configuration file \(en either
58.B /etc/snaptab
59or the
60.I file
61named by the
62.B \-u
63option \(en and retrieves a snapshot
64.I type
65and some options. See
66.BR snaptab (5)
67for the details of the file format and the process of constructing the
68options list. The
69.I device
70is usually the name of a device node, relative to
71.BR /dev ,
72though specific handler programs may have their own conventions.
73.PP
74The option list from the configuration file, the synthesized
75.B op
76option, and the command-line option list, are concatenated, in that
77order; then, if the resulting list contains two or more options with the
78same
79.I key
80then only the last is retained. (The
81.I key
82is the portion of the option before the first
83.RB ` = '
84character.)
85.PP
86Finally, the snapshot handler for the selected
87.I type
88is invoked, as
89.IP
90.BI @snaplibexecdir@/snap. type
91.I device
92.IR key = value
93\&...
94.SS Handler conventions
95Much of the behaviour of
96.B snap
97is left up to individual type-specific handler programs. In order to
98maintain consistency, the following conventions are adopted.
99.PP
100Options are processed strictly left-to-right. Each option is parsed as
101.IP
102.IR key [\fB. type ]\fB= value
103.PP
104where the
105.I key
106and
107.I type
108do not contain
109.RB ` = '
110characters, and the
111.I type
112does not contain a
113.RB ` . '
114character. If the
115.I type
116is omitted, or is equal to the handler's type, then the option is
117processed; the
118.I type
119suffix is otherwise ignored; an error is reported if the
120.I key
121is unrecognized. Options bearing a different type are silently ignored.
122If the same
123.I key
124occurs more than once, only the last occurrence is significant.
125.PP
126Two options are always recognized.
127.TP
128.B op
129Synthesized by the
130.B snap
131program. The value is
132.B snap
133if a snapshot is to be created, or
134.B unsnap
135if it is to be removed (the
136.B \-u
137option was given). It is permissible for handlers to define meanings
138for other
139.B op
140values; unrecognized values are an error.
141.TP
142.B tag
143A short arbitrary string which is assigned to the snapshot to
144distinguish it from snapshots created by other clients. The acceptable
145form for the tag may vary with the snapshot type, but alphanumerics and
146hyphens are always allowed. This option may be omitted, though this is
147discouraged in scripted use: it is not specified whether this is
148equivalent to providing some default tag.
149.PP
150If the
151.B op
152is
153.B snap
154then the handler should print the (full) pathname of the block device
155containing the snapshot to standard output, followed by a newline. If
156.B op
157is
158.B unsnap
159then the handler should print nothing to standard output. Other
160.B op
161values may cause the handler to produce output at its discretion.
162.SH BUGS
163The
164.B snap
165program doesn't even try to handle filesystem-level snapshots, as you'd
166get in ZFS or BtrFS. Trying to do both device- and filesystem-level
167snapshots in one program leads to all sorts of difficulties, and it's
168probably a mistake to try. The distinction is still annoying, though.
169.SH SEE ALSO
170.BR snaptab (5).
171.SH AUTHOR
172Mark Wooding, <mdw@distorted.org.uk>