1 # Copyright (C) 2008-2010 Andre Noll <maan@tuebingen.mpg.de>
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"
42 This option is mostly useful in conjunction with the -R option
45 Note that it is not possible to change whether dss runs as background
46 daemon by sending SIGHUP.
51 "Only print what would be done"
54 This flag does not make sense for all commands. The run
55 command refuses to start if this option was given. The ls
56 command silently ignores this flag.
70 Lower values mean more verbose logging.
75 "Logfile for the dss daemon process"
76 string typestr="filename"
80 This option is only honored if both --run and --daemon are
81 given. Otherwise it is silently ignored and log output is written
84 The default value means that nothing will be logged in daemon mode
85 unless this option is given.
95 dss supports a couple of commands each of which corresponds
96 to a different command line option. Exactly one of these
97 options must be given.
102 groupoption "create" C
103 #~~~~~~~~~~~~~~~~~~~~~
104 "Create a new snapshot"
107 Execute the rsync command to create a new snapshot. Note that
108 this command does not care about free disk space.
111 groupoption "prune" P
112 #~~~~~~~~~~~~~~~~~~~~
113 "Remove redundant and outdated snapshots"
116 A snapshot is considered outdated if its interval number
117 is greater or equal than the specified number of unit
118 intervals. See the \"Intervals\" section below for the precise
119 definition of these terms.
121 A snapshot is said to be redundant if it belongs to an
122 interval that already contains more than the desired number
125 The prune command gets rid of both outdated and redundant
131 "Print a list of all snapshots"
134 The list will contain all snapshots no matter of their state,
135 i. e. incomplete snapshots and snapshots being deleted will
141 "Start creating and pruning snapshots"
144 This is the main mode of operation. Snapshots will be created
145 in an endless loop as needed and pruned automatically. The loop
146 only terminates on fatal errors or if a terminating signal was
147 received. See also the --exit-hook option.
152 "Kill a running dss process"
155 This sends SIGTERM to the dss process that corresponds to the
156 given config file. If --dry-run is given, the PID of the dss
157 process is written to stdout, but no signal is sent.
160 groupoption "reload" -
161 #~~~~~~~~~~~~~~~~~~~~~
162 "force a running dss process to reload its config file"
165 This differs from --kill only in that SIGHUP rather than SIGTERM
166 is sent to the dss process.
169 ###############################
170 section "Rsync-related options"
171 ###############################
173 option "remote-host" H
174 #~~~~~~~~~~~~~~~~~~~~~
176 string typestr="hostname"
180 If this option is given and its value differs from the local
181 host, then rsync uses ssh. Make sure there is no password
182 needed for the ssh connection. To achieve that, use public key
183 authentication for ssh and, if needed, set the remote user name
184 by using the --remote-user option.
187 option "remote-user" U
188 #~~~~~~~~~~~~~~~~~~~~~
189 "Remote user name (default: current user)"
190 string typestr="username"
193 Set this if the user running dss is different from the
194 user at the remote host when using ssh.
197 option "source-dir" -
198 #~~~~~~~~~~~~~~~~~~~~
200 string typestr="dirname"
203 The directory on the remote host from which snapshots are
204 taken. Of course, the user specified as --remote-user must
205 have read access to this directory.
211 string typestr="dirname"
214 The destination directory on the local host where snapshots
215 will be written. This must be writable by the user who runs
221 "Do not try to resume from previous runs"
224 Starting from version 0.1.4, dss tries to resume from a
225 previously cancelled dss instance by default. It does so by
226 looking at the status of the most recently created snapshot. If
227 this snapshot status is incomplete, its directory is reused
228 as the destination directory for a subsequent rsync run.
230 The --no-resume option deactivates this feature so that a new
231 directory is always used as the rsync destination directory.
234 option "rsync-option" O
235 #~~~~~~~~~~~~~~~~~~~~~~
236 "Further rsync options"
237 string typestr="option"
241 This option may be given multiple times. The given argument is
242 passed verbatim to the rsync command. Note that in order to use
243 rsync options that require an argument, you have to specify the
244 option and its argument as separate --rsync-options, like this:
246 --rsync-option --exclude --rsync-option /proc
249 option "max-rsync-errors" -
250 "Terminate after this many rsync failures"
255 Only relevant when operating in --run mode (see above). If
256 the rsync process exits with a fatal error, dss restarts
257 the command in the hope that the problem is transient
258 and subsequent rsync runs succeed. After the given number
259 of consecutive rsync error exits, however, dss gives up,
260 executes the exit hook and terminates. Set this to zero if
261 dss should exit immediately on the first rsync error.
263 The only non-fatal error is when rsync exits with code 24. This
264 indicates a partial transfer due to vanished source files
265 and happens frequently when snapshotting a directory which
266 is concurrently being modified.
273 option "unit-interval" u
274 #~~~~~~~~~~~~~~~~~~~~~~~
275 "The duration of a unit interval"
280 Snapshot aging is implemented in terms of intervals. There are two
281 command line options related to intervals: the duration u of a unit
282 interval and the number of unit intervals, denoted n below.
284 dss removes snapshots older than n times u and tries to keep 2^(n -
285 k - 1) snapshots in interval k, where the interval number k counts
286 from zero to n - 1, with zero being the most recent unit interval.
288 Hence the oldest snapshot will at most be u * n days old (4 days *
289 5 intervals = 20 days, if default values are used). Moreover, there
290 are at most 2^n - 1 snapshots in total (2^5 - 1 = 31 by default). Note
291 that for this to work out your system must be fast enough to create at
292 least 2^(n - 1) snapshots per unit interval (16 snapshots in 4 days =
293 one snapshot in 6 hours), because this is the number of snapshots in
297 option "num-intervals" n
298 #~~~~~~~~~~~~~~~~~~~~~~~
299 "The number of unit intervals"
304 Note that increasing this number by one doubles the total number of
305 snapshots. See the documentation of --unit-interval above.
312 option "pre-create-hook" r
313 #~~~~~~~~~~~~~~~~~~~~~~~~~~
314 "Executed before snapshot creation"
315 string typestr="command"
319 Execute this command before trying to create a new snapshot.
320 If this command returns with a non-zero exit status, no
321 snapshot is being created and the operation is retried later.
323 For example, one might want to execute a script that checks
324 whether all snapshot-related file systems are properly mounted.
326 Another possible application of this is to return non-zero
327 during office hours in order to not slow down the file systems
331 option "post-create-hook" o
332 #~~~~~~~~~~~~~~~~~~~~~~~~~~
333 "Executed after snapshot creation"
334 string typestr="command"
338 Execute this after a snapshot has successfully been
339 created. The full path of the newly created snapshot is
340 passed to the hook as the first argument. The exit code of
341 this hook is ignored.
343 For instance this hook can be used to count the number of
344 files per user and/or the disk usage patterns in order to
345 store them in a database for further analysis.
348 option "pre-remove-hook" -
349 #~~~~~~~~~~~~~~~~~~~~~~~~~~
350 "Executed before snapshot removal"
351 string typestr="command"
355 Execute this command before removing a snapshot. The full
356 path to the snapshot about to be deleted is passed to the
357 command as the first argument. If the command returns with
358 a non-zero exit status, no snapshot is being removed and the
359 operation is retried later.
361 For example, one might want to execute a script that checks
362 whether the snapshot to be deleted is currently used by
363 another process, e.g. by a tape-based backup system that runs
366 Another possible application of this is to record disk-usage
367 patterns before and after snapshot removal.
370 option "post-remove-hook" -
371 #~~~~~~~~~~~~~~~~~~~~~~~~~~
372 "Executed after snapshot removal"
373 string typestr="command"
377 Execute this after a snapshot has successfully been removed. As
378 for the pre-remove hook, the full path of the removed snapshot
379 is passed to the hook as the first argument. The exit code
380 of this hook is ignored.
385 "Executed if run command exits"
386 string typestr="command"
390 This hook is only used if the --run command was given which
391 instructs dss to run in an endless loop. The exit-hook gets
392 executed whenever this endless loop terminates. The reason
393 for terminating the loop is passed as the first argument.
395 One possible application for this hook is to send email to the
396 system administrator to let her know that no more snapshots
397 are going to be created.
400 ###############################
401 section "Disk space monitoring"
402 ###############################
404 option "min-free-mb" m
405 #~~~~~~~~~~~~~~~~~~~~~
406 "Minimal amount of free disk space"
407 int typestr="megabytes"
411 If disk space on the file system containing the destination
412 directory gets low, \"dss --run\" will suspend the currently
413 running rsync process and will start to remove snapshots in
414 order to free disk space. This option specifies the minimal
415 amount of free disk space. If less than the given number of
416 megabytes is available, snapshots are being deleted. See also
417 the --min_free_percent and the min-free-percent-inodes options.
419 A value of zero deactivates this check.
422 option "min-free-percent" p
423 #~~~~~~~~~~~~~~~~~~~~~~~~~~
424 "Minimal percent of free disk space"
425 int typestr="percent"
429 See --min-free-mb. Note that it is not recommended to set both
430 --min-free-mb and --min-free-percent to zero as this will
431 cause your file system to fill up quickly.
433 option "min-free-percent-inodes" i
434 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
435 "Minimal percent of free inodes"
436 int typestr="percent"
440 Specify the minimum amount of free inodes on the file system
441 containing the destination dir. If less than that many inodes
442 are free, snapshot removal kicks in just as in case of low
445 Note that not every file system supports the concept of inodes.
446 Moreover it is not possible to reliably detect whether this is
447 the case. Therefore this feature is disabled by default. It's
448 safe to enable it for ext2/ext3/ext4 file systems on linux
451 A value of zero (the default) deactivates this check.
454 option "keep-redundant" k
455 #~~~~~~~~~~~~~~~~~~~~~~~~
456 "Prune by disk space only"
459 By default, redundant and outdated snapshots are removed automatically
460 to keep the number of snapshots in harmony with the configured
461 policy. If this flag is given, dss removes such snapshots only if
462 disk space or number of free inodes becomes low.
465 option "min-complete" -
466 #~~~~~~~~~~~~~~~~~~~~~~
467 "Minimal number of complete snapshots to keep"
472 This option is only relevant if snapshots must be deleted
473 because disk space gets low.
475 dss refuses to remove old snapshots if there are fewer complete
476 snapshots left than the given number. The default value of one
477 guarantees that at least one complete snapshot is available
480 If only <num> complete snapshot are left, and there is not
481 enough disk space available for another snapshot, the program
482 terminates with a \"No space left on device\" error.