1 # Copyright (C) 2008-2010 Andre Noll <maan@systemlinux.org>
3 # Licensed under the GPL v2. For licencing details see COPYING.
7 purpose "the dyadic snapshot scheduler
9 dss creates hardlink-based snapshots of a given directory on a remote
10 or local host using rsync's link-dest feature.
13 #########################
14 section "General options"
15 #########################
17 option "config-file" c
18 #~~~~~~~~~~~~~~~~~~~~~
19 "(default='~/.dssrc')"
20 string typestr="filename"
23 Options may be given at the command line or in the
24 configuration file. As usual, if an option is given both at
25 the command line and in the configuration file, the command
26 line option takes precedence.
28 However, there is an important exception to this rule:
29 If the --run option was given (see below) then dss honors
30 SIGHUP and re-reads its configuration file whenever it
31 receives this signal. In this case the options in the config
32 file override any options that were previously given at the
33 command line. This allows to change the configuration of a
34 running dss process on the fly by sending SIGHUP.
39 "Run as background daemon"
43 Note that dss refuses to start in daemon mode if no logfile
44 was specified. This option is mostly useful in conjuction
45 with the -R option described below.
47 Note that it is not possible to change whether dss runs as
48 background daemon by sending SIGHUP.
53 "Only print what would be done"
56 This flag does not make sense for all commands. The run
57 command refuses to start if this option was given. The ls
58 command silently ignores this flag.
72 Lower values mean more verbose logging.
77 "Logfile for the dss daemon process"
78 string typestr="filename"
81 This option is only honored if both --run and --daemon are
82 given. Otherwise it is silently ignored and log output is
93 dss supports a couple of commands each of which corresponds
94 to a different command line option. Exactly one of these
95 options must be given.
100 groupoption "create" C
101 #~~~~~~~~~~~~~~~~~~~~~
102 "Create a new snapshot"
105 Execute the rsync command to create a new snapshot. Note that
106 this command does not care about free disk space.
109 groupoption "prune" P
110 #~~~~~~~~~~~~~~~~~~~~
111 "Remove redundant and outdated snapshots"
114 A snapshot is considered outdated if its interval number
115 is greater or equal than the specified number of unit
116 intervals. See the \"Intervals\" section below for the precise
117 definition of these terms.
119 A snapshot is said to be redundant if it belongs to an
120 interval that already contains more than the desired number
123 The prune command gets rid of both outdated and redundant
129 "Print a list of all snapshots"
132 The list will contain all snapshots no matter of their state,
133 i. e. incomplete snapshots and snapshots being deleted will
139 "Start creating and pruning snapshots"
142 This is the main mode of operation. Snapshots will be created
143 in an endless loop as needed and pruned automatically. The loop
144 only terminates on fatal errors or if a terminating signal was
145 received. See also the --exit-hook option.
150 "Kill a running dss process"
153 This sends SIGTERM to the dss process that corresponds to the
154 given config file. If --dry-run is given, the PID of the dss
155 process is written to stdout, but no signal is sent.
158 groupoption "reload" -
159 #~~~~~~~~~~~~~~~~~~~~~
160 "force a running dss process to reload its config file"
163 This differs from --kill only in that SIGHUP rather than SIGTERM
164 is sent to the dss process.
167 ###############################
168 section "Rsync-related options"
169 ###############################
171 option "remote-host" H
172 #~~~~~~~~~~~~~~~~~~~~~
174 string typestr="hostname"
178 If this option is given and its value differs from the local
179 host, then rsync uses ssh. Make sure there is no password
180 needed for the ssh connection. To achieve that, use public key
181 authentication for ssh and, if needed, set the remote user name
182 by using the --remote-user option.
185 option "remote-user" U
186 #~~~~~~~~~~~~~~~~~~~~~
187 "Remote user name (default: current user)"
188 string typestr="username"
191 Set this if the user running dss is different from the
192 user at the remote host when using ssh.
195 option "source-dir" -
196 #~~~~~~~~~~~~~~~~~~~~
198 string typestr="dirname"
201 The directory on the remote host from which snapshots are
202 taken. Of course, the user specified as --remote-user must
203 have read access to this directory.
209 string typestr="dirname"
212 The destination directory on the local host where snapshots
213 will be written. This must be writable by the user who runs
219 "Do not try to resume from previous runs"
222 Starting from version 0.1.4, dss tries to resume from a
223 previously cancelled dss instance by default. It does so by
224 looking at the status of the most recently created snapshot. If
225 this snapshot status is incomplete, its directory is reused
226 as the destination directory for a subsequent rsync run.
228 The --no-resume option deactivates this feature so that a new
229 directory is always used as the rsync destination directory.
232 option "rsync-option" O
233 #~~~~~~~~~~~~~~~~~~~~~~
234 "Further rsync options"
235 string typestr="option"
239 This option may be given multiple times. The given argument is
240 passed verbatim to the rsync command. Note that in order to use
241 rsync options that require an argument, you have to specify the
242 option and its argument as separate --rsync-options, like this:
244 --rsync-option --exclude --rsync-option /proc
251 option "unit-interval" u
252 #~~~~~~~~~~~~~~~~~~~~~~~
253 "The duration of a unit interval"
258 dss snapshot aging is implemented in terms of intervals. There
259 are two command line options related to intervals: the
260 duration u of a \"unit\" interval and the number n of those
263 dss removes any snapshots older than n times u and tries to
264 keep 2^(n - k - 1) snapshots in interval k, where the interval
265 number k counts from zero, zero being the most recent unit
268 In other words, the oldest snapshot will at most be u * n days
269 (= 20 days if default values are used) old. Moreover, there
270 are at most 2^n - 1 snapshots in total (i. e. 31 by default).
271 Observe that you have to create at least 2^(n - 1) snapshots
272 each interval for this to work out because that is the number
273 of snapshots in interval zero.
276 option "num-intervals" n
277 #~~~~~~~~~~~~~~~~~~~~~~~
278 "The number of unit intervals"
287 option "pre-create-hook" r
288 #~~~~~~~~~~~~~~~~~~~~~~~~~~
289 "Executed before snapshot creation"
290 string typestr="command"
294 Execute this command before trying to create a new snapshot.
295 If this command returns with a non-zero exit status, no
296 snapshot is being created and the operation is retried later.
298 For example, one might want to execute a script that checks
299 whether all snapshot-related file systems are properly mounted.
301 Another possible application of this is to return non-zero
302 during office hours in order to not slow down the file systems
306 option "post-create-hook" o
307 #~~~~~~~~~~~~~~~~~~~~~~~~~~
308 "Executed after snapshot creation"
309 string typestr="command"
313 Execute this after a snapshot has successfully been
314 created. The full path of the newly created snapshot is
315 passed to the hook as the first argument. The exit code of
316 this hook is ignored.
318 For instance this hook can be used to count the number of
319 files per user and/or the disk usage patterns in order to
320 store them in a database for further analysis.
323 option "pre-remove-hook" -
324 #~~~~~~~~~~~~~~~~~~~~~~~~~~
325 "Executed before snapshot removal"
326 string typestr="command"
330 Execute this command before removing a snapshot. The full
331 path to the snapshot about to be deleted is passed to the
332 command as the first argument. If the command returns with
333 a non-zero exit status, no snapshot is being removed and the
334 operation is retried later.
336 For example, one might want to execute a script that checks
337 whether the snapshot to be deleted is currently used by
338 another process, e.g. by a tape-based backup system that runs
341 Another possible application of this is to record disk-usage
342 patterns before and after snapshot removal.
345 option "post-remove-hook" -
346 #~~~~~~~~~~~~~~~~~~~~~~~~~~
347 "Executed after snapshot removal"
348 string typestr="command"
352 Execute this after a snapshot has successfully been removed. As
353 for the pre-remove hook, the full path of the removed snapshot
354 is passed to the hook as the first argument. The exit code
355 of this hook is ignored.
360 "Executed if run command exits"
361 string typestr="command"
365 This hook is only used if the --run command was given which
366 instructs dss to run in an endless loop. The exit-hook gets
367 executed whenever this endless loop terminates. The reason
368 for terminating the loop is passed as the first argument.
370 One possible application for this hook is to send email to the
371 system administrator to let her know that no more snapshots
372 are going to be created.
375 ###############################
376 section "Disk space monitoring"
377 ###############################
379 option "min-free-mb" m
380 #~~~~~~~~~~~~~~~~~~~~~
381 "Minimal amount of free disk space"
382 int typestr="megabytes"
386 If disk space on the file system containing the destination
387 directory gets low, \"dss --run\" will suspend the currently
388 running rsync process and will start to remove snapshots in
389 order to free disk space. This option specifies the minimal
390 amount of free disk space. If less than the given number of
391 megabytes is available, snapshots are being deleted. See also
392 the --min_free_percent and the min-free-percent-inodes options.
394 A value of zero deactivates this check.
397 option "min-free-percent" p
398 #~~~~~~~~~~~~~~~~~~~~~~~~~~
399 "Minimal percent of free disk space"
400 int typestr="percent"
404 See --min-free-mb. Note that it is not recommended to set both
405 --min-free-mb and --min-free-percent to zero as this will
406 cause your file system to fill up quickly.
408 option "min-free-percent-inodes" i
409 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
410 "Minimal percent of free inodes"
411 int typestr="percent"
415 Specify the minimum amount of free inodes on the file system
416 containing the destination dir. If less than that many inodes
417 are free, snapshot removal kicks in just as in case of low
420 Note that not every file system supports the concept of inodes.
421 Moreover it is not possible to reliably detect whether this is
422 the case. Therefore this feature is disabled by default. It's
423 safe to enable it for ext2/ext3/ext4 file systems on linux
426 A value of zero (the default) deactivates this check.
429 option "keep-redundant" k
430 #~~~~~~~~~~~~~~~~~~~~~~~~
431 "Prune by disk space only"
434 If this flag is not given dss removes redundant and outdated
435 snapshots automatically.
437 Otherwise, this feature is deactivated so that snapshots are
438 only being removed in case disk space or number of free inodes
439 becomes low. Use this flag if the file system containing the
440 destination directory is used for snapshots only.