xref: /freebsd/sbin/dump/dump.8 (revision 4a0f765fbf09711e612e86fce8bb09ec43f482d9)
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
14.\"    must display the following acknowledgement:
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.\"
33.\"     @(#)dump.8	8.1 (Berkeley) 6/16/93
34.\"	$FreeBSD$
35.\"
36.Dd June 16, 1993
37.Dt DUMP 8
38.Os BSD 4
39.Sh NAME
40.Nm dump
41.Nd filesystem backup
42.Sh SYNOPSIS
43.Nm dump
44.Op Cm 0123456789BTWabcdfhnsu Op Ar argument ...
45.Op Ar filesystem
46.Sh DESCRIPTION
47.Nm Dump
48examines files
49on a filesystem
50and determines which files
51need to be backed up. These files
52are copied to the given disk, tape or other
53storage medium for safe keeping (see the
54.Cm f
55option below for doing remote backups).
56A dump that is larger than the output medium is broken into
57multiple volumes.
58On most media the size is determined by writing until an
59end-of-media indication is returned.  This can be enforced
60by using the
61.Cm a
62option.
63.Pp
64On media that cannot reliably return an end-of-media indication
65(such as some cartridge tape drives)
66each volume is of a fixed size;
67the actual size is determined by the tape size and density and/or
68block count options below.
69By default, the same output file name is used for each volume
70after prompting the operator to change media.
71.Pp
72The following options are supported by
73.Nm dump:
74.Bl -tag -width 4n
75.It Cm 0\-9
76Dump levels.
77A level 0, full backup,
78guarantees the entire file system is copied
79(but see also the
80.Cm h
81option below).
82A level number above 0,
83incremental backup,
84tells dump to
85copy all files new or modified since the
86last dump of the same or lower level. The default
87level is 9.
88.It Cm B Ar records
89The number of dump records per volume.
90This option overrides the calculation of tape size
91based on length and density.
92.It Cm a
93.Dq auto-size .
94Bypass all tape length considerations, and enforce writing
95until an end-of-media indication is returned.  This fits best
96for most modern tape drives.  Use of this option is particularly
97recommended when appending to an existing tape, or using a tape
98drive with hardware compression (where you can never be sure about
99the compression ratio).
100.It Cm b Ar blocksize
101The number of kilobytes per dump record.
102.It Cm c
103Change the defaults for use with a cartridge tape drive, with a density
104of 8000 bpi, and a length of 1700 feet.
105.It Cm h Ar level
106Honor the user
107.Dq nodump
108flag
109.Dp Dv UF_NODUMP
110only for dumps at or above the given
111.Ar level .
112The default honor level is 1,
113so that incremental backups omit such files
114but full backups retain them.
115.It Cm f Ar file
116Write the backup to
117.Ar file ;
118.Ar file
119may be a special device file
120like
121.Pa /dev/rst0
122(a tape drive),
123.Pa /dev/rfd1
124(a floppy disk drive),
125an ordinary file,
126or
127.Ql Fl
128(the standard output).
129Multiple file names may be given as a single argument separated by commas.
130Each file will be used for one dump volume in the order listed;
131if the dump requires more volumes than the number of names given,
132the last file name will used for all remaining volumes after prompting
133for media changes.
134If the name of the file is of the form
135.Dq host:file ,
136or
137.Dq user@host:file ,
138.Nm dump
139writes to the named file on the remote host using
140.Xr rmt 8 .
141The default path name of the remote
142.Xr rmt 8
143program is
144.\" rmt path, is the path on the remote host
145.Pa /etc/rmt ;
146this can be overridden by the environment variable
147.Ev RMT .
148.It Cm d Ar density
149Set tape density to
150.Ar density .
151The default is 1600BPI.
152.It Cm n
153Whenever
154.Nm dump
155requires operator attention,
156notify all operators in the group
157.Dq operator
158by means similar to a
159.Xr wall 1 .
160.It Cm s Ar feet
161Attempt to calculate the amount of tape needed
162at a particular density.
163If this amount is exceeded,
164.Nm dump
165prompts for a new tape.
166It is recommended to be a bit conservative on this option.
167The default tape length is 2300 feet.
168.It Cm u
169Update the file
170.Pa /etc/dumpdates
171after a successful dump.
172The format of
173.Pa /etc/dumpdates
174is readable by people, consisting of one
175free format record per line:
176filesystem name,
177increment level
178and
179.Xr ctime 3
180format dump date.
181There may be only one entry per filesystem at each level.
182The file
183.Pa /etc/dumpdates
184may be edited to change any of the fields,
185if necessary.
186.It Cm T Ar date
187Use the specified date as the starting time for the dump
188instead of the time determined from looking in
189.Pa /etc/dumpdates .
190The format of date is the same as that of
191.Xr ctime 3 .
192This option is useful for automated dump scripts that wish to
193dump over a specific period of time.
194The
195.Cm T
196option is mutually exclusive from the
197.Cm u
198option.
199.It Cm W
200.Nm Dump
201tells the operator what file systems need to be dumped.
202This information is gleaned from the files
203.Pa /etc/dumpdates
204and
205.Pa /etc/fstab .
206The
207.Cm W
208option causes
209.Nm dump
210to print out, for each file system in
211.Pa /etc/dumpdates
212the most recent dump date and level,
213and highlights those file systems that should be dumped.
214If the
215.Cm W
216option is set, all other options are ignored, and
217.Nm dump
218exits immediately.
219.It Cm w
220Is like W, but prints only those filesystems which need to be dumped.
221.El
222.Pp
223.Nm Dump
224requires operator intervention on these conditions:
225end of tape,
226end of dump,
227tape write error,
228tape open error or
229disk read error (if there are more than a threshold of 32).
230In addition to alerting all operators implied by the
231.Cm n
232key,
233.Nm dump
234interacts with the operator on
235.Em dump's
236control terminal at times when
237.Nm dump
238can no longer proceed,
239or if something is grossly wrong.
240All questions
241.Nm dump
242poses
243.Em must
244be answered by typing
245.Dq yes
246or
247.Dq no ,
248appropriately.
249.Pp
250Since making a dump involves a lot of time and effort for full dumps,
251.Nm dump
252checkpoints itself at the start of each tape volume.
253If writing that volume fails for some reason,
254.Nm dump
255will,
256with operator permission,
257restart itself from the checkpoint
258after the old tape has been rewound and removed,
259and a new tape has been mounted.
260.Pp
261.Nm Dump
262tells the operator what is going on at periodic intervals,
263including usually low estimates of the number of blocks to write,
264the number of tapes it will take, the time to completion, and
265the time to the tape change.
266The output is verbose,
267so that others know that the terminal
268controlling
269.Nm dump
270is busy,
271and will be for some time.
272.Pp
273In the event of a catastrophic disk event, the time required
274to restore all the necessary backup tapes or files to disk
275can be kept to a minimum by staggering the incremental dumps.
276An efficient method of staggering incremental dumps
277to minimize the number of tapes follows:
278.Bl -bullet -offset indent
279.It
280Always start with a level 0 backup, for example:
281.Bd -literal -offset indent
282/sbin/dump 0uf /dev/nrst0 /usr/src
283.Ed
284.Pp
285This should be done at set intervals, say once a month or once every two months,
286and on a set of fresh tapes that is saved forever.
287.It
288After a level 0, dumps of active file
289systems are taken on a daily basis,
290using a modified Tower of Hanoi algorithm,
291with this sequence of dump levels:
292.Bd -literal -offset indent
2933 2 5 4 7 6 9 8 9 9 ...
294.Ed
295.Pp
296For the daily dumps, it should be possible to use a fixed number of tapes
297for each day, used on a weekly basis.
298Each week, a level 1 dump is taken, and
299the daily Hanoi sequence repeats beginning with 3.
300For weekly dumps, another fixed set of tapes per dumped file system is
301used, also on a cyclical basis.
302.El
303.Pp
304After several months or so, the daily and weekly tapes should get
305rotated out of the dump cycle and fresh tapes brought in.
306.Sh ENVIRONMENT
307The environment variable
308.Ev RMT
309will be used to determine the pathname of the remote
310.Xr rmt 8
311program.
312.Sh FILES
313.Bl -tag -width /etc/dumpdates -compact
314.It Pa /dev/rst0
315default tape unit to dump to
316.It Pa /etc/dumpdates
317dump date records
318.It Pa /etc/fstab
319dump table: file systems and frequency
320.It Pa /etc/group
321to find group
322.Em operator
323.El
324.Sh SEE ALSO
325.Xr dump 5 ,
326.Xr fstab 5 ,
327.Xr ft 8 ,
328.Xr restore 8 ,
329.Xr rmt 8
330.Sh DIAGNOSTICS
331Many, and verbose.
332.Pp
333Dump exits with zero status on success.
334Startup errors are indicated with an exit code of 1;
335abnormal termination is indicated with an exit code of 3.
336.Sh BUGS
337.Pp
338Fewer than 32 read errors on the filesystem are ignored.
339Each reel requires a new process, so parent processes for
340reels already written just hang around until the entire tape
341is written.
342.Pp
343Currently,
344.Xr physio 9
345slices all requests into chunks of 64 KB.  Therefore, it is
346impossible to use a larger tape blocksize, so
347.Nm dump
348will prevent this from happening.
349.Pp
350.Nm Dump
351with the
352.Cm W
353or
354.Cm w
355options does not report filesystems that have never been recorded
356in
357.Pa /etc/dumpdates ,
358even if listed in
359.Pa /etc/fstab .
360.Pp
361It would be nice if
362.Nm dump
363knew about the dump sequence,
364kept track of the tapes scribbled on,
365told the operator which tape to mount when,
366and provided more assistance
367for the operator running
368.Xr restore .
369.Pp
370.Nm dump
371cannot do remote backups without being run as root, due to its
372security history.  This will be fixed in a later version of FreeBSD.
373Presently, it work if you set it setuid (like it used to be), but this
374might constitute a security risk.
375.Sh HISTORY
376A
377.Nm dump
378command appeared in
379.At v6 .
380