forked from rsnapshot/rsnapshot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rsnapshot.1
1198 lines (1198 loc) · 39.6 KB
/
rsnapshot.1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
.\" Automatically generated by Pod::Man 2.16 (Pod::Simple 3.05)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sh \" Subsection heading
.br
.if t .Sp
.ne 5
.PP
\fB\\$1\fR
.PP
..
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings. \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote. \*(C+ will
.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
.\" nothing in troff, for use with C<>.
.tr \(*W-
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
. ds -- \(*W-
. ds PI pi
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
. ds L" ""
. ds R" ""
. ds C` ""
. ds C' ""
'br\}
.el\{\
. ds -- \|\(em\|
. ds PI \(*p
. ds L" ``
. ds R" ''
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\"
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.ie \nF \{\
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. nr % 0
. rr F
.\}
.el \{\
. de IX
..
.\}
.\"
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
.\" Fear. Run. Save yourself. No user-serviceable parts.
. \" fudge factors for nroff and troff
.if n \{\
. ds #H 0
. ds #V .8m
. ds #F .3m
. ds #[ \f1
. ds #] \fP
.\}
.if t \{\
. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
. ds #V .6m
. ds #F 0
. ds #[ \&
. ds #] \&
.\}
. \" simple accents for nroff and troff
.if n \{\
. ds ' \&
. ds ` \&
. ds ^ \&
. ds , \&
. ds ~ ~
. ds /
.\}
.if t \{\
. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
.\}
. \" troff and (daisy-wheel) nroff accents
.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
.ds ae a\h'-(\w'a'u*4/10)'e
.ds Ae A\h'-(\w'A'u*4/10)'E
. \" corrections for vroff
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
. \" for low resolution devices (crt and lpr)
.if \n(.H>23 .if \n(.V>19 \
\{\
. ds : e
. ds 8 ss
. ds o a
. ds d- d\h'-1'\(ga
. ds D- D\h'-1'\(hy
. ds th \o'bp'
. ds Th \o'LP'
. ds ae ae
. ds Ae AE
.\}
.rm #[ #] #H #V #F C
.\" ========================================================================
.\"
.IX Title "RSNAPSHOT-PROGRAM 1"
.TH RSNAPSHOT-PROGRAM 1 "2010-03-17" "perl v5.10.0" "User Contributed Perl Documentation"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH "NAME"
rsnapshot \- remote filesystem snapshot utility
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
\&\fBrsnapshot\fR [\fB\-vtxqVD\fR] [\fB\-c\fR cfgfile] [command] [args]
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
\&\fBrsnapshot\fR is a filesystem snapshot utility. It can take incremental
snapshots of local and remote filesystems for any number of machines.
.PP
Local filesystem snapshots are handled with \fB\f(BIrsync\fB\|(1)\fR. Secure remote
connections are handled with rsync over \fB\f(BIssh\fB\|(1)\fR, while anonymous
rsync connections simply use an rsync server. Both remote and local
transfers depend on rsync.
.PP
\&\fBrsnapshot\fR saves much more disk space than you might imagine. The amount
of space required is roughly the size of one full backup, plus a copy
of each additional file that is changed. \fBrsnapshot\fR makes extensive
use of hard links, so if the file doesn't change, the next snapshot is
simply a hard link to the exact same file.
.PP
\&\fBrsnapshot\fR will typically be invoked as root by a cron job, or series
of cron jobs. It is possible, however, to run as any arbitrary user
with an alternate configuration file.
.PP
All important options are specified in a configuration file, which is
located by default at \fB/etc/rsnapshot.conf\fR. An alternate file can be
specified on the command line. There are also additional options which
can be passed on the command line.
.PP
The command line options are as follows:
.Sp
.RS 4
\&\fB\-v\fR verbose, show shell commands being executed
.Sp
\&\fB\-t\fR test, show shell commands that would be executed
.Sp
\&\fB\-c\fR path to alternate config file
.Sp
\&\fB\-x\fR one filesystem, don't cross partitions within each backup point
.Sp
\&\fB\-q\fR quiet, suppress non-fatal warnings
.Sp
\&\fB\-V\fR same as \-v, but with more detail
.Sp
\&\fB\-D\fR a firehose of diagnostic information
.RE
.SH "CONFIGURATION"
.IX Header "CONFIGURATION"
\&\fB/etc/rsnapshot.conf\fR is the default configuration file. All parameters
in this file must be separated by tabs. \fB/etc/rsnapshot.conf.default\fR
can be used as a reference.
.PP
It is recommended that you copy \fB/etc/rsnapshot.conf.default\fR to
\&\fB/etc/rsnapshot.conf\fR, and then modify \fB/etc/rsnapshot.conf\fR to suit
your needs.
.PP
Long lines may be split over several lines. \*(L"Continuation\*(R" lines
\&\fBmust\fR begin with a space or a tab character. Continuation lines will
have all leading and trailing whitespace stripped off, and then be appended
with an intervening tab character to the previous line when the configuation
file is parsed.
.PP
Here is a list of allowed parameters:
.Sp
.RS 4
\&\fBconfig_version\fR Config file version (required). Default is 1.2
.Sp
\&\fBsnapshot_root\fR Local filesystem path to save all snapshots
.Sp
\&\fBinclude_conf\fR Include another file in the configuration at this point.
.Sp
.RS 4
This is recursive, but you may need to be careful about paths when specifying
which file to include. We check to see if the file you have specified is
readable, and will yell an error if it isn't. We recommend using a full
path. As a special case, include_conf's value may be enclosed in `backticks`
in which case it will be executed and whatever it spits to \s-1STDOUT\s0 will
be included in the configuration. Note that shell meta-characters may be
interpreted.
.RE
.RE
.RS 4
.Sp
\&\fBno_create_root\fR If set to 1, rsnapshot won't create snapshot_root directory
.Sp
\&\fBcmd_rsync\fR Full path to rsync (required)
.Sp
\&\fBcmd_ssh\fR Full path to ssh (optional)
.Sp
\&\fBcmd_cp\fR Full path to cp (optional, but must be \s-1GNU\s0 version)
.Sp
.RS 4
If you are using Linux, you should uncomment cmd_cp. If you are using a
platform which does not have \s-1GNU\s0 cp, you should leave cmd_cp commented out.
.Sp
With \s-1GNU\s0 cp, rsnapshot can take care of both normal files and special
files (such as FIFOs, sockets, and block/character devices) in one pass.
.Sp
If cmd_cp is disabled, rsnapshot will use its own built-in function,
\&\fInative_cp_al()\fR to backup up regular files and directories. This will
then be followed up by a separate call to rsync, to move the special
files over (assuming there are any).
.RE
.RE
.RS 4
.Sp
\&\fBcmd_rm\fR Full path to rm (optional)
.Sp
\&\fBcmd_logger\fR Full path to logger (optional, for syslog support)
.Sp
\&\fBcmd_du\fR Full path to du (optional, for disk usage reports)
.Sp
\&\fBcmd_rsnapshot_diff\fR Full path to rsnapshot-diff (optional)
.Sp
\&\fBcmd_preexec\fR
.Sp
.RS 4
Full path (plus any arguments) to preexec script (optional).
This script will run immediately before each backup operation (but not any
rotations).
.RE
.RE
.RS 4
.Sp
\&\fBcmd_postexec\fR
.Sp
.RS 4
Full path (plus any arguments) to postexec script (optional).
This script will run immediately after each backup operation (but not any
rotations).
.RE
.RE
.RS 4
.Sp
\&\fBlinux_lvm_cmd_lvcreate\fR
.Sp
\&\fBlinux_lvm_cmd_lvremove\fR
.Sp
\&\fBlinux_lvm_cmd_mount\fR
.Sp
\&\fBlinux_lvm_cmd_umount\fR
.Sp
.RS 4
Paths to lvcreate, lvremove, mount and umount commands, for use with Linux
LVMs. You may include options to the commands also.
The lvcreate, lvremove, mount and umount commands are required for
managing snapshots of \s-1LVM\s0 volumes and are otherwise optional.
.RE
.RE
.RS 4
.Sp
\&\fBretain\fR [name] [number]
.Sp
.RS 4
\&\*(L"name\*(R" refers to the name of this backup level (e.g., alpha, beta,
so also called the 'interval'). \*(L"number\*(R"
is the number of snapshots for this type of interval that will be retained.
The value of \*(L"name\*(R" will be the command passed to \fBrsnapshot\fR to perform
this type of backup.
.Sp
A deprecated alias for 'retain' is 'interval'.
.Sp
Example: \fBretain alpha 6\fR
.Sp
[root@localhost]# \fBrsnapshot alpha\fR
.Sp
For this example, every time this is run, the following will happen:
.Sp
<snapshot_root>/alpha.5/ will be deleted, if it exists.
.Sp
<snapshot_root>/alpha.{1,2,3,4} will all be rotated +1, if they exist.
.Sp
<snapshot_root>/alpha.0/ will be copied to <snapshot_root>/alpha.1/
using hard links.
.Sp
Each backup point (explained below) will then be rsynced to the
corresponding directories in <snapshot_root>/alpha.0/
.Sp
Backup levels must be specified in the config file in order, from most
frequent to least frequent. The first entry is the one which will be
synced with the backup points. The subsequent backup levels (e.g., beta,
gamma, etc) simply rotate, with each higher backup level pulling from the
one below it for its .0 directory.
.Sp
Example:
.Sp
.RS 4
\&\fBretain alpha 6\fR
.Sp
\&\fBretain beta 7\fR
.Sp
\&\fBretain gamma 4\fR
.RE
.RE
.RS 4
.Sp
beta.0/ will be copied from alpha.5/, and gamma.0/ will be copied from beta.6/
.Sp
alpha.0/ will be rsynced directly from the filesystem.
.RE
.RE
.RS 4
.Sp
\&\fBlink_dest 1\fR
.Sp
.RS 4
If your version of rsync supports \-\-link\-dest (2.5.7 or newer), you can enable
this to let rsync handle some things that \s-1GNU\s0 cp or the built-in subroutines would
otherwise do. Enabling this makes rsnapshot take a slightly more complicated code
branch, but it's the best way to support special files on non-Linux systems.
.RE
.RE
.RS 4
.Sp
\&\fBsync_first 1\fR
.Sp
.RS 4
sync_first changes the behaviour of rsnapshot. When this is enabled, all calls
to rsnapshot with various backup levels simply rotate files. All backups are handled
by calling rsnapshot with the \*(L"sync\*(R" argument. The synced files are stored in
a \*(L".sync\*(R" directory under the snapshot_root.
.Sp
This allows better recovery in the event that rsnapshot is interrupted in the
middle of a sync operation, since the sync step and rotation steps are
separated. This also means that you can easily run \*(L"rsnapshot sync\*(R" on the
command line without fear of forcing all the other directories to rotate up.
This benefit comes at the cost of one more snapshot worth of disk space.
The default is 0 (off).
.RE
.RE
.RS 4
.Sp
\&\fBverbose 2\fR
.Sp
.RS 4
The amount of information to print out when the program is run. Allowed values
are 1 through 5. The default is 2.
.Sp
.Vb 5
\& 1 Quiet Show fatal errors only
\& 2 Default Show warnings and errors
\& 3 Verbose Show equivalent shell commands being executed
\& 4 Extra Verbose Same as verbose, but with more detail
\& 5 Debug All kinds of information
.Ve
.RE
.RE
.RS 4
.Sp
\&\fBloglevel 3\fR
.Sp
.RS 4
This number means the same thing as \fBverbose\fR above, but it determines how
much data is written to the logfile, if one is being written.
.Sp
The only thing missing from this at the higher levels is the direct output
from rsync. We hope to add support for this in a future release.
.RE
.RE
.RS 4
.Sp
\&\fBlogfile /var/log/rsnapshot\fR
.Sp
.RS 4
Full filesystem path to the rsnapshot log file. If this is defined, a log file
will be written, with the amount of data being controlled by \fBloglevel\fR. If
this is commented out, no log file will be written.
.RE
.RE
.RS 4
.Sp
\&\fBinclude [file\-name\-pattern]\fR
.Sp
.RS 4
This gets passed directly to rsync using the \-\-include directive. This
parameter can be specified as many times as needed, with one pattern defined
per line. See the \fIrsync\fR\|(1) man page for the syntax.
.RE
.RE
.RS 4
.Sp
\&\fBexclude [file\-name\-pattern]\fR
.Sp
.RS 4
This gets passed directly to rsync using the \-\-exclude directive. This
parameter can be specified as many times as needed, with one pattern defined
per line. See the \fIrsync\fR\|(1) man page for the syntax.
.RE
.RE
.RS 4
.Sp
\&\fBinclude_file /path/to/include/file\fR
.Sp
.RS 4
This gets passed directly to rsync using the \-\-include\-from directive. See the
\&\fIrsync\fR\|(1) man page for the syntax.
.RE
.RE
.RS 4
.Sp
\&\fBexclude_file /path/to/exclude/file\fR
.Sp
.RS 4
This gets passed directly to rsync using the \-\-exclude\-from directive. See the
\&\fIrsync\fR\|(1) man page for the syntax.
.RE
.RE
.RS 4
.Sp
\&\fBrsync_short_args \-a\fR
.Sp
.RS 4
List of short arguments to pass to rsync. If not specified,
\&\*(L"\-a\*(R" is the default. Please note that these must be all next to each other.
For example, \*(L"\-az\*(R" is valid, while \*(L"\-a \-z\*(R" is not.
.Sp
\&\*(L"\-a\*(R" is rsync's \*(L"archive mode\*(R" which tells it to copy as much of the
filesystem metadata as it can for each file. This specifically does *not*
include information about hard links, as that would greatly increase rsync's
memory usage and slow it down. If you need to preserve hard links in your
backups, then add \*(L"H\*(R" to this.
.RE
.RE
.RS 4
.Sp
\&\fBrsync_long_args \-\-delete \-\-numeric\-ids \-\-relative \-\-delete\-excluded\fR
.Sp
.RS 4
List of long arguments to pass to rsync. The default values are
\-\-delete \-\-numeric\-ids \-\-relative \-\-delete\-excluded
This means that the directory structure in each backup point destination
will match that in the backup point source.
.Sp
Quotes are permitted in rsync_long_args, eg \-\-rsync\-path=\*(L"sudo /usr/bin/rsync\*(R".
You may use either single (') or double (") quotes, but nested quotes (including
mixed nested quotes) are not permitted. Similar quoting is also allowed in
per-backup-point rsync_long_args.
.RE
.RE
.RS 4
.Sp
\&\fBssh_args \-p 22\fR
.Sp
.RS 4
Arguments to be passed to ssh. If not specified, the default is none.
.RE
.RE
.RS 4
.Sp
\&\fBdu_args \-csh\fR
.Sp
.RS 4
Arguments to be passed to du. If not specified, the default is \-csh.
\&\s-1GNU\s0 du supports \-csh, \s-1BSD\s0 du supports \-csk, Solaris du doesn't support
\&\-c at all. The \s-1GNU\s0 version is recommended, since it offers the most
features.
.RE
.RE
.RS 4
.Sp
\&\fBlockfile /var/run/rsnapshot.pid\fR
.Sp
\&\fBstop_on_stale_lockfile 0\fR
.Sp
.RS 4
Lockfile to use when rsnapshot is run. This prevents a second invocation
from clobbering the first one. If not specified, no lock file is used.
Make sure to use a directory that is not world writeable for security
reasons. Use of a lock file is strongly recommended.
.Sp
If a lockfile exists when rsnapshot starts, it will try to read the file
and stop with an error if it can't. If it *can* read the file, it sees if
a process exists with the \s-1PID\s0 noted in the file. If it does, rsnapshot
stops with an error message. If there is no process with that \s-1PID\s0, then
we assume that the lockfile is stale and ignore it *unless*
stop_on_stale_lockfile is set to 1 in which case we stop.
.Sp
stop_on_stale_lockfile defaults to 0.
.RE
.RE
.RS 4
.Sp
\&\fBone_fs 1\fR
.Sp
.RS 4
Prevents rsync from crossing filesystem partitions. Setting this to a value
of 1 enables this feature. 0 turns it off. This parameter is optional.
The default is 0 (off).
.RE
.RE
.RS 4
.Sp
\&\fBuse_lazy_deletes 1\fR
.Sp
.RS 4
Changes default behavior of rsnapshot and does not initially remove the
oldest snapshot. Instead it moves that directory to _delete.[processid] and
continues as normal. Once the backup has been completed, the lockfile will
be removed before rsnapshot starts deleting the directory.
.Sp
Enabling this means that snapshots get taken sooner (since the delete doesn't
come first), and any other rsnapshot processes are allowed to start while the
final delete is happening. This benefit comes at the cost of using more
disk space. The default is 0 (off).
.Sp
The details of how this works have changed in rsnapshot version 1.3.1.
Originally you could only ever have one .delete directory per backup level.
Now you can have many, so if your next (eg) alpha backup kicks off while the
previous one is still doing a lazy delete you may temporarily have extra
_delete directories hanging around.
.RE
.RE
.RS 4
.Sp
\&\fBlinux_lvm_snapshotsize 2G\fR
.Sp
.RS 4
\&\s-1LVM\s0 snapshot(s) size (lvcreate \-\-size option).
.RE
.RE
.RS 4
.Sp
\&\fBlinux_lvm_snapshotname rsnapshot\fR
.Sp
.RS 4
Name to be used when creating the \s-1LVM\s0 logical volume snapshot(s) (lvcreate \-\-name option).
.RE
.RE
.RS 4
.Sp
\&\fBlinux_lvm_vgpath /dev\fR
.Sp
.RS 4
Path to the \s-1LVM\s0 Volume Groups.
.RE
.RE
.RS 4
.Sp
\&\fBlinux_lvm_mountpath /mnt/lvm\-snapshot\fR
.Sp
.RS 4
Mount point to use to temporarily mount the snapshot(s).
.RE
.RE
.RS 4
.Sp
\&\fBbackup\fR /etc/ localhost/
.Sp
\&\fBbackup\fR [email protected]:/etc/ example.com/
.Sp
\&\fBbackup\fR rsync://example.com/path2/ example.com/
.Sp
\&\fBbackup\fR /var/ localhost/ one_fs=1
.Sp
\&\fBbackup\fR lvm://vg0/home/path2/ lvm\-vg0/
.Sp
\&\fBbackup_script\fR /usr/local/bin/backup_pgsql.sh pgsql_backup/
.Sp
.RS 4
Examples:
.Sp
\&\fBbackup /etc/ localhost/\fR
.Sp
.RS 4
Backs up /etc/ to <snapshot_root>/<retain>.0/localhost/etc/ using rsync on
the local filesystem
.RE
.RE
.RS 4
.Sp
\&\fBbackup /usr/local/ localhost/\fR
.Sp
.RS 4
Backs up /usr/local/ to <snapshot_root>/<retain>.0/localhost/usr/local/
using rsync on the local filesystem
.RE
.RE
.RS 4
.Sp
\&\fBbackup [email protected]:/etc/ example.com/\fR
.Sp
.RS 4
Backs up [email protected]:/etc/ to <snapshot_root>/<retain>.0/example.com/etc/
using rsync over ssh
.RE
.RE
.RS 4
.Sp
\&\fBbackup example.com:/etc/ example.com/\fR
.Sp
.RS 4
Same thing but let ssh choose the remote username (as specified in
~/.ssh/config, otherwise the same as the local username)
.RE
.RE
.RS 4
.Sp
\&\fBbackup [email protected]:/usr/local/ example.com/\fR
.Sp
.RS 4
Backs up [email protected]:/usr/local/ to
<snapshot_root>/<retain>.0/example.com/usr/local/ using rsync over ssh
.RE
.RE
.RS 4
.Sp
\&\fBbackup rsync://example.com/pub/ example.com/pub/\fR
.Sp
.RS 4
Backs up rsync://example.com/pub/ to <snapshot_root>/<retain>.0/example.com/pub/
using an anonymous rsync server. Please note that unlike backing up local paths
and using rsync over ssh, rsync servers have \*(L"modules\*(R", which are top level
directories that are exported. Therefore, the module should also be specified in
the destination path, as shown in the example above (the pub/ directory at the
end).
.RE
.RE
.RS 4
.Sp
\&\fBbackup /var/ localhost/ one_fs=1\fR
.Sp
.RS 4
This is the same as the other examples, but notice the fourth column.
This is how you specify per-backup-point options to over-ride global
settings. This extra parameter can take several options, separated
by \fBcommas\fR.
.Sp
It is most useful when specifying per-backup rsync excludes thus:
.Sp
\&\fBbackup root@somehost:/ somehost +rsync_long_args=\-\-exclude=/var/spool/\fR
.Sp
Note the + sign. That tells rsnapshot to \fIadd\fR to the list of arguments
to pass to rsync instead of replacing the list.
.RE
.RE
.RS 4
.Sp
\&\fBbackup lvm://vg0/home/path2/ lvm\-vg0/\fR
.Sp
.RS 4
Backs up the \s-1LVM\s0 logical volume called home, of volume group vg0, to
<snapshot_root>/<interval>.0/lvm\-vg0/. Will create, mount, backup, unmount and remove an \s-1LVM\s0
snapshot for each lvm:// entry.
.RE
.RE
.RS 4
.Sp
\&\fBbackup_script /usr/local/bin/backup_database.sh db_backup/\fR
.Sp
.RS 4
In this example, we specify a script or program to run. This script should simply
create files and/or directories in its current working directory. rsnapshot will
then take that output and move it into the directory specified in the third column.
.Sp
Please note that whatever is in the destination directory will be completely
deleted and recreated. For this reason, rsnapshot prevents you from specifying
a destination directory for a backup_script that will clobber other backups.
.Sp
So in this example, say the backup_database.sh script simply runs a command like:
.Sp
.RS 4
#!/bin/sh
.Sp
mysqldump \-uusername mydatabase > mydatabase.sql
.Sp
chmod u=r,go= mydatabase.sql # r\-\-\-\-\-\-\-\- (0400)
.RE
.RE
.RS 4
.Sp
rsnapshot will take the generated \*(L"mydatabase.sql\*(R" file and move it into the
<snapshot_root>/<retain>.0/db_backup/ directory. On subsequent runs,
rsnapshot checks the differences between the files created against the
previous files. If the backup script generates the same output on the next
run, the files will be hard linked against the previous ones, and no
additional disk space will be taken up.
.RE
.RE
.RS 4
.RE
.RE
.RS 4
.Sp
Remember that tabs must separate all elements, and that
there must be a trailing slash on the end of every directory.
.Sp
A hash mark (#) on the beginning of a line is treated
as a comment.
.Sp
Putting it all together (an example file):
.Sp
.Vb 1
\& # THIS IS A COMMENT, REMEMBER TABS MUST SEPARATE ALL ELEMENTS
\&
\& config_version 1.2
\&
\& snapshot_root /.snapshots/
\&
\& cmd_rsync /usr/bin/rsync
\& cmd_ssh /usr/bin/ssh
\& #cmd_cp /bin/cp
\& cmd_rm /bin/rm
\& cmd_logger /usr/bin/logger
\& cmd_du /usr/bin/du
\&
\& linux_lvm_cmd_lvcreate /sbin/lvcreate
\& linux_lvm_cmd_lvremove /sbin/lvremove
\& linux_lvm_cmd_mount /bin/mount
\& linux_lvm_cmd_umount /bin/umount
\&
\& linux_lvm_snapshotsize 2G
\& linux_lvm_snapshotname rsnapshot
\& linux_lvm_vgpath /dev
\& linux_lvm_mountpath /mnt/lvm\-snapshot
\&
\& retain alpha 6
\& retain beta 7
\& retain gamma 7
\& retain delta 3
\&
\& backup /etc/ localhost/
\& backup /home/ localhost/
\& backup_script /usr/local/bin/backup_mysql.sh mysql_backup/
\&
\& backup [email protected]:/etc/ foo.com/
\& backup [email protected]:/home/ foo.com/
\& backup [email protected]:/home/ mail.foo.com/
\& backup rsync://example.com/pub/ example.com/pub/
\& backup lvm://vg0/xen\-home/ lvm\-vg0/xen\-home/
.Ve
.RE
.RS 4
.RE
.SH "USAGE"
.IX Header "USAGE"
\&\fBrsnapshot\fR can be used by any user, but for system-wide backups
you will probably want to run it as root.
.PP
Since backups usually get neglected if human intervention is
required, the preferred way is to run it from cron.
.PP
When you are first setting up your backups, you will probably
also want to run it from the command line once or twice to get
a feel for what it's doing.
.PP
Here is an example crontab entry, assuming that backup levels \fBalpha\fR,
\&\fBbeta\fR, \fBgamma\fR and \fBdelta\fR have been defined in \fB/etc/rsnapshot.conf\fR
.Sp
.RS 4
\&\fB0 */4 * * * /usr/local/bin/rsnapshot alpha\fR
.Sp
\&\fB50 23 * * * /usr/local/bin/rsnapshot beta\fR
.Sp
\&\fB40 23 * * 6 /usr/local/bin/rsnapshot gamma\fR
.Sp
\&\fB30 23 1 * * /usr/local/bin/rsnapshot delta\fR
.RE
.PP
This example will do the following:
.Sp
.RS 4
6 alpha backups a day (once every 4 hours, at 0,4,8,12,16,20)
.Sp
1 beta backup every day, at 11:50PM
.Sp
1 gamma backup every week, at 11:40PM, on Saturdays (6th day of week)
.Sp
1 delta backup every month, at 11:30PM on the 1st day of the month
.RE
.PP
It is usually a good idea to schedule the larger backup levels to run a bit before the
lower ones. For example, in the crontab above, notice that \*(L"beta\*(R" runs 10 minutes
before \*(L"alpha\*(R". The main reason for this is that the beta rotate will
pull out the oldest alpha and make that the youngest beta (which means
that the next alpha rotate will not need to delete the oldest alpha),
which is more efficient. A secondary reason is that it is harder to
predict how long the lowest backup level will take, since it needs to actually
do an rsync of the source as well as the rotate that all backups do.
.PP
If rsnapshot takes longer than 10 minutes to do the \*(L"beta\*(R" rotate
(which usually includes deleting the oldest beta snapshot), then you
should increase the time between the backup levels.
Otherwise (assuming you have set the \fBlockfile\fR parameter, as is recommended)
your alpha snapshot will fail sometimes because the beta still has the lock.
.PP
Remember that these are just the times that the program runs.
To set the number of backups stored, set the \fBretain\fR numbers in
\&\fB/etc/rsnapshot.conf\fR
.PP
To check the disk space used by rsnapshot, you can call it with the \*(L"du\*(R" argument.
.PP
For example:
.Sp
.RS 4
\&\fBrsnapshot du\fR
.RE
.PP
This will show you exactly how much disk space is taken up in the snapshot root. This
feature requires the \s-1UNIX\s0 \fBdu\fR command to be installed on your system, for it to
support the \*(L"\-csh\*(R" command line arguments, and to be in your path. You can also
override your path settings and the flags passed to du using the cmd_du and du_args
parameters.
.PP
It is also possible to pass a relative file path as a second argument, to get a report
on a particular file or subdirectory.
.Sp
.RS 4
\&\fBrsnapshot du localhost/home/\fR
.RE
.PP
The \s-1GNU\s0 version of \*(L"du\*(R" is preferred. The \s-1BSD\s0 version works well also, but does
not support the \-h flag (use \-k instead, to see the totals in kilobytes). Other
versions of \*(L"du\*(R", such as Solaris, may not work at all.
.PP
To check the differences between two directories, call rsnapshot with the \*(L"diff\*(R"
argument, followed by two backup levels or directory paths.
.PP
For example:
.Sp
.RS 4
\&\fBrsnapshot diff beta.0 beta.1\fR
.Sp
\&\fBrsnapshot diff beta.0/localhost/etc beta.1/localhost/etc\fR
.Sp
\&\fBrsnapshot diff /.snapshots/beta.0 /.snapshots/beta.1\fR
.RE
.PP
This will call the rsnapshot-diff program, which will scan both directories
looking for differences (based on hard links).
.PP
\&\fBrsnapshot sync\fR
.Sp
.RS 4
When \fBsync_first\fR is enabled, rsnapshot must first be called with the \fBsync\fR
argument, followed by the other usual cron entries. The sync should happen as
the lowest, most frequent backup level, and right before. For example:
.Sp
.RS 4
\&\fB0 */4 * * * /usr/local/bin/rsnapshot sync && /usr/local/bin/rsnapshot alpha\fR
.Sp
\&\fB50 23 * * * /usr/local/bin/rsnapshot beta\fR
.Sp
\&\fB40 23 1,8,15,22 * * /usr/local/bin/rsnapshot gamma\fR
.Sp
\&\fB30 23 1 * * /usr/local/bin/rsnapshot delta\fR
.RE
.RE
.RS 4
.Sp
The sync operation simply runs rsync and all backup scripts. In this scenario, all
calls simply rotate directories, even the lowest backup level.
.RE
.PP
\&\fBrsnapshot sync [dest]\fR
.Sp
.RS 4
When \fBsync_first\fR is enabled, all sync behaviour happens during an additional
sync step (see above). When using the sync argument, it is also possible to specify
a backup point destination as an optional parameter. If this is done, only backup
points sharing that destination path will be synced.
.Sp
For example, let's say that example.com is a destination path shared by one or more
of your backup points.
.Sp
.RS 4
rsnapshot sync example.com
.RE
.RE
.RS 4
.Sp
This command will only sync the files that normally get backed up into example.com.
It will \s-1NOT\s0 get any other backup points with slightly different values (like
example.com/etc/, for example). In order to sync example.com/etc, you would need to
run rsnapshot again, using example.com/etc as the optional parameter.
.RE
.SH "EXIT VALUES"
.IX Header "EXIT VALUES"
.RS 4
\&\fB0\fR All operations completed successfully
.Sp
\&\fB1\fR A fatal error occurred
.Sp
\&\fB2\fR Some warnings occurred, but the backup still finished
.RE
.SH "FILES"
.IX Header "FILES"
/etc/rsnapshot.conf
.SH "SEE ALSO"
.IX Header "SEE ALSO"
\&\fIrsync\fR\|(1), \fIssh\fR\|(1), \fIlogger\fR\|(1), \fIsshd\fR\|(1), \fIssh\-keygen\fR\|(1), \fIperl\fR\|(1), \fIcp\fR\|(1), \fIdu\fR\|(1), \fIcrontab\fR\|(1)
.SH "DIAGNOSTICS"
.IX Header "DIAGNOSTICS"
Use the \fB\-t\fR flag to see what commands would have been executed. This will show
you the commands rsnapshot would try to run. There are a few minor differences
(for example, not showing an attempt to remove the lockfile because it wasn't
really created in the test), but should give you a very good idea what will happen.
.PP
Using the \fB\-v\fR, \fB\-V\fR, and \fB\-D\fR flags will print increasingly more information
to \s-1STDOUT\s0.
.PP
Make sure you don't have spaces in the config file that you think are actually tabs.
.PP
Much other weird behavior can probably be attributed to plain old file system
permissions and ssh authentication issues.
.SH "BUGS"
.IX Header "BUGS"
Please report bugs (and other comments) to the rsnapshot-discuss mailing list:
.PP
\&\fBhttp://lists.sourceforge.net/lists/listinfo/rsnapshot\-discuss\fR
.SH "NOTES"
.IX Header "NOTES"
Make sure your /etc/rsnapshot.conf file has all elements separated by tabs.
See /etc/rsnapshot.conf.default for a working example file.
.PP
Make sure you put a trailing slash on the end of all directory references.
If you don't, you may have extra directories created in your snapshots.
For more information on how the trailing slash is handled, see the
\&\fB\f(BIrsync\fB\|(1)\fR manpage.
.PP
Make sure to make the snapshot directory chmod 700 and owned by root
(assuming backups are made by the root user). If the snapshot directory
is readable by other users, they will be able to modify the snapshots
containing their files, thus destroying the integrity of the snapshots.
.PP
If you would like regular users to be able to restore their own backups,
there are a number of ways this can be accomplished. One such scenario
would be:
.PP
Set \fBsnapshot_root\fR to \fB/.private/.snapshots\fR in \fB/etc/rsnapshot.conf\fR
.PP
Set the file permissions on these directories as follows:
.Sp
.RS 4
drwx\-\-\-\-\-\- /.private
.Sp
drwxr-xr-x /.private/.snapshots
.RE
.PP
Export the /.private/.snapshots directory over read-only \s-1NFS\s0, a read-only
Samba share, etc.
.PP
See the rsnapshot \s-1HOWTO\s0 for more information on making backups
accessible to non-privileged users.
.PP
For ssh to work unattended through cron, you will probably want to use
public key logins. Create an ssh key with no passphrase for root, and
install the public key on each machine you want to backup. If you are
backing up system files from remote machines, this probably means
unattended root logins. Another possibility is to create a second user
on the machine just for backups. Give the user a different name such
as \*(L"rsnapshot\*(R", but keep the \s-1UID\s0 and \s-1GID\s0 set to 0, to give root
privileges. However, make logins more restrictive, either through ssh
configuration, or using an alternate shell.
.PP
\&\s-1BE\s0 \s-1CAREFUL\s0! If the private key is obtained by an attacker, they will
have free run of all the systems involved. If you are unclear on how
to do this, see \fB\f(BIssh\fB\|(1)\fR, \fB\f(BIsshd\fB\|(1)\fR, and \fB\f(BIssh\-keygen\fB\|(1)\fR.
.PP
Backup scripts are run as the same user that rsnapshot is running as.
Typically this is root. Make sure that all of your backup scripts are