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