]> git.wh0rd.org - dump.git/blame - dump/dump.8.in
Make dump/restore use O_CREAT|O_TRUNC both locally and remotely.
[dump.git] / dump / dump.8.in
CommitLineData
1227625a
SP
1.\" Copyright (c) 1980, 1991, 1993
2.\" Regents of the University of California.
3.\" All rights reserved.
4.\"
5.\" Redistribution and use in source and binary forms, with or without
6.\" modification, are permitted provided that the following conditions
7.\" are met:
8.\" 1. Redistributions of source code must retain the above copyright
9.\" notice, this list of conditions and the following disclaimer.
10.\" 2. Redistributions in binary form must reproduce the above copyright
11.\" notice, this list of conditions and the following disclaimer in the
12.\" documentation and/or other materials provided with the distribution.
13.\" 3. All advertising materials mentioning features or use of this software
ddd2ef55 14.\" must display the following acknowledgement:
1227625a
SP
15.\" This product includes software developed by the University of
16.\" California, Berkeley and its contributors.
17.\" 4. Neither the name of the University nor the names of its contributors
18.\" may be used to endorse or promote products derived from this software
19.\" without specific prior written permission.
20.\"
21.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31.\" SUCH DAMAGE.
32.\"
0cedbda5 33.\" $Id: dump.8.in,v 1.40 2002/04/04 08:20:23 stelian Exp $
1227625a 34.\"
8d4197bb 35.Dd __DATE__
1227625a 36.Dt DUMP 8
df9ae507 37.Os "dump __VERSION__"
1227625a
SP
38.Sh NAME
39.Nm dump
ddd2ef55 40.Nd ext2 filesystem backup
1227625a
SP
41.Sh SYNOPSIS
42.Nm dump
e084ba00 43.Op Fl 0123456789ackMnqSu
e51470bf 44.Op Fl A Ar file
1227625a
SP
45.Op Fl B Ar records
46.Op Fl b Ar blocksize
47.Op Fl d Ar density
6d732772
SP
48.Op Fl e Ar inode numbers
49.Op Fl E Ar file
1227625a 50.Op Fl f Ar file
0d7af9c5 51.Op Fl F Ar script
1227625a 52.Op Fl h Ar level
b82d31dc 53.Op Fl I Ar nr errors
88ef261e 54.Op Fl j Ar compression level
b45f51d6 55.Op Fl L Ar label
35b24fb7 56.Op Fl Q Ar file
1227625a
SP
57.Op Fl s Ar feet
58.Op Fl T Ar date
ce7243e0 59.Op Fl z Ar compression level
a94ecd11 60.Ar files-to-dump
1227625a
SP
61.Nm dump
62.Op Fl W Li \&| Fl w
63.Pp
8d4197bb 64.in
1227625a
SP
65(The
66.Bx 4.3
ddd2ef55 67option syntax is implemented for backward compatibility but
1227625a
SP
68is not documented here.)
69.Sh DESCRIPTION
70.Nm Dump
71examines files
ddd2ef55 72on an ext2 filesystem
1227625a
SP
73and determines which files
74need to be backed up. These files
75are copied to the given disk, tape or other
76storage medium for safe keeping (see the
77.Fl f
78option below for doing remote backups).
79A dump that is larger than the output medium is broken into
80multiple volumes.
81On most media the size is determined by writing until an
4f4eee3d 82end-of-media indication is returned.
b45f51d6 83.Pp
1227625a 84On media that cannot reliably return an end-of-media indication
4f4eee3d
SP
85(such as some cartridge tape drives), each volume is of a fixed size;
86the actual size is determined by specifying cartridge media, or via the
87tape size, density and/or block count options below.
1227625a
SP
88By default, the same output file name is used for each volume
89after prompting the operator to change media.
90.Pp
a94ecd11 91.Ar files-to-dump
79e31865 92is either a mountpoint of a filesystem
a94ecd11
SP
93or a list of files and directories to be backed up as a subset of a
94filesystem.
79e31865
SP
95In the former case, either the path to a mounted filesystem
96or the device of an unmounted filesystem can be used.
97In the latter case, certain restrictions are placed on the backup:
98.Fl u
a94ecd11
SP
99is not allowed, the only dump level that is supported is
100.Fl 0
101and all the files and directories must reside on the same filesystem.
79e31865 102.Pp
1227625a 103The following options are supported by
b45f51d6 104.Nm Ns :
1227625a
SP
105.Bl -tag -width Ds
106.It Fl 0\-9
107Dump levels.
108A level 0, full backup,
109guarantees the entire file system is copied
110(but see also the
111.Fl h
112option below).
113A level number above 0,
114incremental backup,
ddd2ef55
SP
115tells
116.Nm dump
117to
1227625a 118copy all files new or modified since the
ae58c8da 119last dump of a lower level.
ddd2ef55 120The default level is 9.
b45f51d6
SP
121.It Fl a
122.Dq auto-size .
4f4eee3d
SP
123Bypass all tape length calculations, and write
124until an end-of-media indication is returned. This works best
125for most modern tape drives, and is the default.
126Use of this option is particularly recommended when appending to an
127existing tape, or using a tape drive with hardware compression
128(where you can never be sure about the compression ratio).
e51470bf
SP
129.It Fl A Ar archive_file
130Archive a dump table-of-contents in the
131specified
132.Ar archive_file
133to be used by
134.Xr restore 8
135to determine whether a file is in the dump file that is being restored.
1227625a
SP
136.It Fl b Ar blocksize
137The number of kilobytes per dump record.
ddd2ef55 138Since the IO system slices all requests into chunks of MAXBSIZE
aca7d867 139(typically 64kB), it is not possible to use a larger blocksize
ddd2ef55
SP
140without having problems later with
141.Xr restore 8 .
142Therefore
143.Nm dump
144will constrain writes to MAXBSIZE.
65bceb9b 145The default blocksize is 10.
e51470bf 146.It Fl B Ar records
27305a35
SP
147The number of 1 kB blocks per volume. Not normally required, as
148.Nm
149can detect end-of-media. When the specified size is reached,
150.Nm
151waits for you to change the volume. This option overrides
152the calculation of tape size based on length and density.
153If compression is on this limits the size of the compressed
154output per volume.
1227625a 155.It Fl c
b45f51d6 156Change the defaults for use with a cartridge tape drive, with a density
4f4eee3d
SP
157of 8000 bpi, and a length of 1700 feet. Specifying a cartridge drive
158overrides the end-of-media detection.
e51470bf
SP
159.It Fl d Ar density
160Set tape density to
161.Ar density .
162The default is 1600BPI. Specifying a tape density overrides the
163end-of-media detection.
6d732772 164.It Fl e Ar inodes
20c345aa 165Exclude
6d732772
SP
166.Ar inodes
167from the dump. The
168.Ar inodes
169parameter is a comma separated list of inode numbers (you can use
20c345aa
SP
170.Ar stat
171to find the inode number for a file or directory).
6d732772
SP
172.It Fl E Ar file
173Read list of inodes to be excluded from the dump from the text file
174.Ar file .
175The file
176.Ar file
177should be an ordinary file containing inode numbers separated by
178newlines.
1227625a
SP
179.It Fl f Ar file
180Write the backup to
181.Ar file ;
182.Ar file
183may be a special device file
184like
ddd2ef55 185.Pa /dev/st0
1227625a
SP
186(a tape drive),
187.Pa /dev/rsd1c
b45f51d6 188(a floppy disk drive),
1227625a
SP
189an ordinary file,
190or
191.Ql Fl
192(the standard output).
193Multiple file names may be given as a single argument separated by commas.
194Each file will be used for one dump volume in the order listed;
195if the dump requires more volumes than the number of names given,
196the last file name will used for all remaining volumes after prompting
197for media changes.
198If the name of the file is of the form
ddd2ef55 199.Dq host:file
1227625a 200or
ddd2ef55 201.Dq user@host:file
b45f51d6 202.Nm
1227625a
SP
203writes to the named file on the remote host using
204.Xr rmt 8 .
b45f51d6
SP
205The default path name of the remote
206.Xr rmt 8
207program is
208.\" rmt path, is the path on the remote host
209.Pa /etc/rmt ;
210this can be overridden by the environment variable
211.Ev RMT .
0d7af9c5 212.It Fl F Ar script
365a7c7c
SP
213Run script at the end of each tape. The device name and the
214current volume number are passed on the command line.
215The script must return 0 if
ae81b200
SP
216.Nm
217should continue without asking the user to change the tape, 1 if
218.Nm
c534413c 219should continue but ask the user to change the tape.
ae81b200
SP
220Any other exit code will cause
221.Nm
222to abort.
223For security reasons,
224.Nm
225reverts back to the real user ID and the real group ID before
226running the script.
e51470bf
SP
227.It Fl h Ar level
228Honor the user
229.Dq nodump
230flag
231.Dp Dv UF_NODUMP
232only for dumps at or above the given
233.Ar level .
234The default honor level is 1,
235so that incremental backups omit such files
236but full backups retain them.
b82d31dc
SP
237.It Fl I Ar nr errors
238By default,
239.Nm
240will ignore the first 32 read errors on the file
241system before asking for operator intervention. You can change this
242using this flag to any value. This is useful when running
243.Nm
244on an active filesystem where read errors simply indicate an
245inconsistency between the mapping and dumping passes.
88ef261e
SP
246.It Fl j Ar compression level
247Compress every block to be written on the tape using bzlib library. This
248option will work only when dumping to a file or pipe or, when dumping
249to a tape drive, if the tape drive is capable of writing variable
250length blocks. You will need at least the 0.4b24 version of restore in
251order to extract compressed tapes. Tapes written using compression will
252not be compatible with the BSD tape format. The (optional) parameter
253specifies the compression level bzlib will use. The default compression
a2caea8a
SP
254level is 2. If the optional parameter is specified, there should be no
255white space between the option letter and the parameter.
b45f51d6
SP
256.It Fl k
257Use Kerberos authentication to talk to remote tape servers. (Only
258available if this option was enabled when
259.Nm
260was compiled.)
261.It Fl L Ar label
262The user-supplied text string
263.Ar label
264is placed into the dump header, where tools like
265.Xr restore 8
266and
267.Xr file 1
268can access it.
269Note that this label is limited
270to be at most LBLSIZE (currently 16) characters, which must include
271the terminating
272.Ql \e0 .
0cedbda5
SP
273.It Fl m
274If this flag is specified,
275.Nm
276will optimise the output for inodes having been changed but not
277modified since the last dump ('changed' and 'modified' have the
278meaning defined in stat(2)). For those inodes,
279.Nm
280will save only the metadata, instead of saving the entire inode
281contents. Inodes which are either directories or have been modified
282since the last dump are saved in a regular way.
283Uses of this flag must be consistent, meaning that either every dump
284in an incremental dump set have the flag, or no one has it.
285.Pp
286Tapes written using such 'metadata only' inodes will not be compatible
287with the BSD tape format or older versions of
288.Nm restore.
dc7cb1e2
SP
289.It Fl M
290Enable the multi-volume feature. The name specified with
291.Fl f
292is treated as a prefix and
293.Nm
294writes in sequence to <prefix>001, <prefix>002 etc. This can be
295useful when dumping to files on an ext2 partition, in order to bypass
296the 2GB file size limitation.
1227625a
SP
297.It Fl n
298Whenever
b45f51d6 299.Nm
1227625a
SP
300requires operator attention,
301notify all operators in the group
302.Dq operator
303by means similar to a
304.Xr wall 1 .
e084ba00
SP
305.It Fl q
306Make
307.Nm
308abort immediately whenever operator attention is required,
309without prompting in case of write errors, tape changes etc.
35b24fb7
SP
310.It Fl Q Ar file
311Enable the Quick File Access support. Tape positions for each
312inode are stored into the file
313.Ar file
314which is used by restore (if called with parameter Q and the filename)
315to directly position the tape at the file restore is currently working
316on. This saves hours when restoring single files from large backups,
317saves the tapes and the drive's head.
b8f7cbe6
SP
318.Pp
319It is recommended to set up the st driver to return logical tape
320positions rather than physical before calling dump/restore with
321parameter Q. Since not all tape devices support physical tape
322positions those tape devices return an error during dump/restore when
323the st driver is set to the default physical setting.
324Please see the st man page, option MTSETDRVBUFFER, or the mt man
325page, on how to set the driver to return logical tape positions.
326.Pp
327Before calling restore with parameter Q, always make sure the st
328driver is set to return the same type of tape position used during the
329call to dump. Otherwise restore may be confused.
103122b3
SP
330.Pp
331This option can be used when dumping to local tapes (see above)
332or to local files.
1227625a 333.It Fl s Ar feet
4f4eee3d 334Attempt to calculate the amount of tape needed at a particular density.
1227625a 335If this amount is exceeded,
b45f51d6 336.Nm
1227625a
SP
337prompts for a new tape.
338It is recommended to be a bit conservative on this option.
4f4eee3d
SP
339The default tape length is 2300 feet. Specifying the tape size
340overrides end-of-media detection.
1227625a 341.ne 1i
144a6db1
SP
342.It Fl S
343Size estimate. Determine the amount of space
344that is needed to perform the dump without
345actually doing it, and display the estimated
2e682895 346number of bytes it will take. This is useful
144a6db1
SP
347with incremental dumps to determine how many
348volumes of media will be needed.
1227625a
SP
349.It Fl T Ar date
350Use the specified date as the starting time for the dump
351instead of the time determined from looking in
8d4197bb 352.Pa __DUMPDATES__ .
ddd2ef55
SP
353The format of
354.Ar date
355is the same as that of
1227625a
SP
356.Xr ctime 3 .
357This option is useful for automated dump scripts that wish to
358dump over a specific period of time.
359The
360.Fl T
361option is mutually exclusive from the
362.Fl u
363option.
364.It Fl u
365Update the file
8d4197bb 366.Pa __DUMPDATES__
1227625a
SP
367after a successful dump.
368The format of
8d4197bb 369.Pa __DUMPDATES__
1227625a
SP
370is readable by people, consisting of one
371free format record per line:
372filesystem name,
373increment level
374and
375.Xr ctime 3
376format dump date.
377There may be only one entry per filesystem at each level.
378The file
8d4197bb 379.Pa __DUMPDATES__
1227625a
SP
380may be edited to change any of the fields,
381if necessary.
382.It Fl W
383.Nm Dump
384tells the operator what file systems need to be dumped.
385This information is gleaned from the files
8d4197bb 386.Pa __DUMPDATES__
1227625a
SP
387and
388.Pa /etc/fstab .
389The
390.Fl W
391option causes
b45f51d6 392.Nm
51b01afe 393to print out, for all file systems in
8d4197bb 394.Pa __DUMPDATES__ ,
51b01afe
SP
395and regognized file systems in
396.Pa /etc/fstab .
1227625a 397the most recent dump date and level,
51b01afe 398and highlights those that should be dumped.
1227625a
SP
399If the
400.Fl W
401option is set, all other options are ignored, and
b45f51d6 402.Nm
1227625a
SP
403exits immediately.
404.It Fl w
ddd2ef55
SP
405Is like
406.Fl W ,
51b01afe
SP
407but prints only recognized filesystems in
408.Pa /etc/fstab
409which need to be dumped.
ce7243e0 410.It Fl z Ar compression level
52ed7d6e 411Compress every block to be written on the tape using zlib library. This
2b747532
SP
412option will work only when dumping to a file or pipe or, when dumping
413to a tape drive, if the tape drive is capable of writing variable
52ed7d6e
SP
414length blocks. You will need at least the 0.4b22 version of restore in
415order to extract compressed tapes. Tapes written using compression will
ce7243e0
SP
416not be compatible with the BSD tape format. The (optional) parameter
417specifies the compression level zlib will use. The default compression
a2caea8a
SP
418level is 2. If the optional parameter is specified, there should be no
419white space between the option letter and the parameter.
1227625a
SP
420.El
421.Pp
422.Nm Dump
423requires operator intervention on these conditions:
424end of tape,
425end of dump,
426tape write error,
427tape open error or
b82d31dc 428disk read error (if there is more than a threshold of nr errors).
1227625a
SP
429In addition to alerting all operators implied by the
430.Fl n
431key,
b45f51d6 432.Nm
1227625a
SP
433interacts with the operator on
434.Em dump's
435control terminal at times when
b45f51d6 436.Nm
1227625a
SP
437can no longer proceed,
438or if something is grossly wrong.
439All questions
b45f51d6 440.Nm
1227625a
SP
441poses
442.Em must
443be answered by typing
444.Dq yes
445or
446.Dq no ,
447appropriately.
448.Pp
449Since making a dump involves a lot of time and effort for full dumps,
b45f51d6 450.Nm
1227625a
SP
451checkpoints itself at the start of each tape volume.
452If writing that volume fails for some reason,
b45f51d6 453.Nm
1227625a
SP
454will,
455with operator permission,
456restart itself from the checkpoint
457after the old tape has been rewound and removed,
458and a new tape has been mounted.
459.Pp
460.Nm Dump
461tells the operator what is going on at periodic intervals,
462including usually low estimates of the number of blocks to write,
463the number of tapes it will take, the time to completion, and
464the time to the tape change.
465The output is verbose,
466so that others know that the terminal
467controlling
b45f51d6 468.Nm
1227625a
SP
469is busy,
470and will be for some time.
471.Pp
472In the event of a catastrophic disk event, the time required
473to restore all the necessary backup tapes or files to disk
474can be kept to a minimum by staggering the incremental dumps.
475An efficient method of staggering incremental dumps
476to minimize the number of tapes follows:
477.Bl -bullet -offset indent
478.It
479Always start with a level 0 backup, for example:
480.Bd -literal -offset indent
8d4197bb 481/sbin/dump -0u -f /dev/st0 /usr/src
1227625a
SP
482.Ed
483.Pp
484This should be done at set intervals, say once a month or once every two months,
485and on a set of fresh tapes that is saved forever.
486.It
487After a level 0, dumps of active file
488systems are taken on a daily basis,
489using a modified Tower of Hanoi algorithm,
490with this sequence of dump levels:
491.Bd -literal -offset indent
4923 2 5 4 7 6 9 8 9 9 ...
493.Ed
494.Pp
495For the daily dumps, it should be possible to use a fixed number of tapes
496for each day, used on a weekly basis.
497Each week, a level 1 dump is taken, and
498the daily Hanoi sequence repeats beginning with 3.
499For weekly dumps, another fixed set of tapes per dumped file system is
500used, also on a cyclical basis.
501.El
502.Pp
503After several months or so, the daily and weekly tapes should get
504rotated out of the dump cycle and fresh tapes brought in.
b45f51d6
SP
505.Sh ENVIRONMENT
506.Bl -tag -width Fl
507.It Ev TAPE
508If no -f option was specified,
509.Nm
510will use the device specified via
511.Ev TAPE
512as the dump device.
513.Ev TAPE
514may be of the form
515.Qq tapename ,
516.Qq host:tapename ,
517or
518.Qq user@host:tapename .
519.It Ev RMT
520The environment variable
521.Ev RMT
522will be used to determine the pathname of the remote
523.Xr rmt 8
524program.
0c62667d
SP
525.It Ev RSH
526.Nm Dump
527uses the contents of this variable to determine the name of the
528remote shell command to use when doing remote backups (rsh, ssh etc.).
529If this variable is not set,
530.Xr rcmd 3
531will be used, but only root will be able to do remote backups.
7ae7e903 532.El
1227625a 533.Sh FILES
8d4197bb 534.Bl -tag -width __DUMPDATES__ -compact
ddd2ef55 535.It Pa /dev/st0
1227625a 536default tape unit to dump to
8d4197bb 537.It Pa __DUMPDATES__
1227625a
SP
538dump date records
539.It Pa /etc/fstab
540dump table: file systems and frequency
541.It Pa /etc/group
542to find group
543.Em operator
544.El
545.Sh SEE ALSO
b45f51d6 546.Xr fstab 5 ,
1227625a 547.Xr restore 8 ,
b45f51d6 548.Xr rmt 8
1227625a
SP
549.Sh DIAGNOSTICS
550Many, and verbose.
551.Pp
ddd2ef55
SP
552.Nm Dump
553exits with zero status on success.
1227625a
SP
554Startup errors are indicated with an exit code of 1;
555abnormal termination is indicated with an exit code of 3.
556.Sh BUGS
ddd2ef55
SP
557It might be considered a bug that this version of dump can only handle ext2
558filesystems. Specifically, it does not work with FAT filesystems.
559.Pp
b82d31dc
SP
560Fewer than 32 read errors (change this with -I)
561on the filesystem are ignored. If noticing
ddd2ef55
SP
562read errors is important, the output from dump can be parsed to look for lines
563that contain the text 'read error'.
1227625a
SP
564.Pp
565Each reel requires a new process, so parent processes for
566reels already written just hang around until the entire tape
567is written.
568.Pp
e7850aac
SP
569The estimated number of tapes is not correct if compression is on.
570.Pp
1227625a 571It would be nice if
b45f51d6 572.Nm
1227625a
SP
573knew about the dump sequence,
574kept track of the tapes scribbled on,
575told the operator which tape to mount when,
576and provided more assistance
577for the operator running
578.Xr restore .
b45f51d6
SP
579.Pp
580.Nm Dump
581cannot do remote backups without being run as root, due to its
0c62667d 582security history.
b45f51d6 583Presently, it works if you set it setuid (like it used to be), but this
0c62667d
SP
584might constitute a security risk. Note that you can set RSH to use
585a remote shell program instead.
8d4197bb
SP
586.Sh AUTHOR
587The
588.Nm dump/restore
7422942f 589backup suite was ported to Linux's Second Extended File System
8d4197bb
SP
590by Remy Card <card@Linux.EU.Org>. He maintained the initial versions
591of dump (up and including 0.4b4, released in january 1997).
592.Pp
593Starting with 0.4b5, the new maintainer is Stelian Pop
594.br
11856e77 595<stelian@popies.net>.
8d4197bb
SP
596.Sh AVAILABILITY
597The
598.Nm dump/restore
7422942f 599backup suite is available from
01fb6bd5
SP
600.br
601http://dump.sourceforge.net
1227625a
SP
602.Sh HISTORY
603A
b45f51d6
SP
604.Nm
605command appeared in
606.At v6 .