xref: /dragonfly/sbin/dump/dump.8 (revision caa7a3ee)
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 acknowledgment:
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.\" $FreeBSD: src/sbin/dump/dump.8,v 1.27.2.18 2003/02/23 19:58:23 trhodes Exp $
35.\"
36.Dd March 1, 2002
37.Dt DUMP 8
38.Os
39.Sh NAME
40.Nm dump ,
41.Nm rdump
42.Nd UFS file system backup
43.Sh SYNOPSIS
44.Nm
45.Op Fl 0123456789acknSu
46.Op Fl B Ar records
47.Op Fl b Ar blocksize
48.Op Fl D Ar dumpdates
49.Op Fl C Ar cachesize
50.Op Fl d Ar density
51.Op Fl f Ar file
52.Op Fl h Ar level
53.Op Fl s Ar feet
54.Op Fl T Ar date
55.Ar filesystem
56.Nm
57.Fl W | Fl w
58.Sh DESCRIPTION
59The
60.Nm
61utility examines files
62on a file system
63and determines which files
64need to be backed up.
65These files
66are copied to the given disk, tape or other
67storage medium for safe keeping (see the
68.Fl f
69option below for doing remote backups).
70A dump that is larger than the output medium is broken into
71multiple volumes.
72On most media the size is determined by writing until an
73end-of-media indication is returned.
74This 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
83.Fl B
84options.
85By default, the same output file name is used for each volume
86after prompting the operator to change media.
87.Pp
88The file system to be dumped is specified by the argument
89.Ar filesystem
90as either its device-special file or its mount point
91(if that is in a standard entry in
92.Pa /etc/fstab ) .
93.Pp
94.Nm
95may also be invoked as
96.Nm rdump .
97The
98.Bx 4.3
99option syntax is implemented for backward compatibility, but
100is not documented here.
101.Pp
102The following options are supported by
103.Nm :
104.Bl -tag -width Ds
105.It Fl 0-9
106Dump levels.
107A level 0, full backup,
108guarantees the entire file system is copied
109(but see also the
110.Fl h
111option below).
112A level number above 0,
113incremental backup,
114tells dump to
115copy all files new or modified since the
116last dump of any lower level.
117The default level is 0.
118.It Fl a
119.Dq auto-size .
120Bypass all tape length considerations, and enforce writing
121until an end-of-media indication is returned.
122This fits best for most modern tape drives.
123Use of this option is particularly
124recommended when appending to an existing tape, or using a tape
125drive with hardware compression (where you can never be sure about
126the compression ratio).
127.It Fl B Ar records
128The number of kilobytes per output volume, except that if it is
129not an integer multiple of the output block size,
130the command uses the next smaller such multiple.
131This option overrides the calculation of tape size
132based on length and density.
133.It Fl b Ar blocksize
134The number of kilobytes per output block, except that if it is
135larger than 64, the command uses 64. (See the BUGS section.)
136The default block size is 10.
137.It Fl c
138Change the defaults for use with a cartridge tape drive, with a density
139of 8000 bpi, and a length of 1700 feet.
140.It Fl D Ar dumpdates
141Specify an alternate path to the
142.Pa dumpdates
143file.
144The default is
145.Pa /etc/dumpdates .
146.It Fl C Ar cachesize
147Specify the cache size in megabytes.  This will greatly improve performance
148at the cost of
149.Nm
150possibly not noticing changes in the filesystem between passes.
151Beware that
152.Nm
153forks, and the actual memory use may be larger than the specified cache
154size.  The recommended cache size is between 8 and 32 (megabytes).
155.It Fl d Ar density
156Set tape density to
157.Ar density .
158The default is 1600BPI.
159.It Fl f Ar file
160Write the backup to
161.Ar file ;
162.Ar file
163may be a special device file
164like
165.Pa /dev/sa0
166(a tape drive),
167.Pa /dev/fd1
168(a floppy disk drive),
169an ordinary file,
170or
171.Sq Fl
172(the standard output).
173Multiple file names may be given as a single argument separated by commas.
174Each file will be used for one dump volume in the order listed;
175if the dump requires more volumes than the number of names given,
176the last file name will used for all remaining volumes after prompting
177for media changes.
178If the name of the file is of the form
179.Dq host:file ,
180or
181.Dq user@host:file ,
182.Nm
183writes to the named file on the remote host using
184.Xr rmt 8 .
185The default path name of the remote
186.Xr rmt 8
187program is
188.\" rmt path, is the path on the remote host
189.Pa /etc/rmt ;
190this can be overridden by the environment variable
191.Ev RMT .
192.It Fl h Ar level
193Honor the user
194.Dq nodump
195flag
196.Pq Dv UF_NODUMP
197only for dumps at or above the given
198.Ar level .
199The default honor level is 1,
200so that incremental backups omit such files
201but full backups retain them.
202.It Fl k
203Use Kerberos authentication to talk to remote tape servers.  (Only
204available if this option was enabled when
205.Nm
206was compiled.)
207.It Fl n
208Whenever
209.Nm
210requires operator attention,
211notify all operators in the group
212.Dq operator
213by means similar to a
214.Xr wall 1 .
215.It Fl s Ar feet
216Attempt to calculate the amount of tape needed
217at a particular density.
218If this amount is exceeded,
219.Nm
220prompts for a new tape.
221It is recommended to be a bit conservative on this option.
222The default tape length is 2300 feet.
223.It Fl S
224Display an estimate of the backup size and the number of
225tapes required, and exit without actually performing the dump.
226.It Fl T Ar date
227Use the specified date as the starting time for the dump
228instead of the time determined from looking in
229the
230.Pa dumpdates
231file.
232The format of date is the same as that of
233.Xr ctime 3 .
234This option is useful for automated dump scripts that wish to
235dump over a specific period of time.
236The
237.Fl T
238option is mutually exclusive from the
239.Fl u
240option.
241.It Fl u
242Update the
243.Pa dumpdates
244file
245after a successful dump.
246The format of
247the
248.Pa dumpdates
249file
250is readable by people, consisting of one
251free format record per line:
252file system name,
253increment level
254and
255.Xr ctime 3
256format dump date.
257There may be only one entry per file system at each level.
258The
259.Pa dumpdates
260file
261may be edited to change any of the fields,
262if necessary.
263The default path for the
264.Pa dumpdates
265file is
266.Pa /etc/dumpdates ,
267but the
268.Fl D
269option may be used to change it.
270.It Fl W
271Tell the operator what file systems need to be dumped.
272This information is gleaned from the files
273.Pa dumpdates
274and
275.Pa /etc/fstab .
276The
277.Fl W
278option causes
279.Nm
280to print out, for each file system in
281the
282.Pa dumpdates
283file
284the most recent dump date and level,
285and highlights those file systems that should be dumped.
286If the
287.Fl W
288option is set, all other options are ignored, and
289.Nm
290exits immediately.
291.It Fl w
292Is like
293.Fl W ,
294but prints only those file systems which need to be dumped.
295.El
296.Pp
297Directories and regular files which have their
298.Dq nodump
299flag
300.Pq Dv UF_NODUMP
301set will be omitted along with everything under such directories,
302subject to the
303.Fl h
304option.
305.Pp
306The
307.Nm
308utility requires operator intervention on these conditions:
309end of tape,
310end of dump,
311tape write error,
312tape open error or
313disk read error (if there are more than a threshold of 32).
314In addition to alerting all operators implied by the
315.Fl n
316key,
317.Nm
318interacts with the operator on
319.Em dump's
320control terminal at times when
321.Nm
322can no longer proceed,
323or if something is grossly wrong.
324All questions
325.Nm
326poses
327.Em must
328be answered by typing
329.Dq yes
330or
331.Dq no ,
332appropriately.
333.Pp
334Since making a dump involves a lot of time and effort for full dumps,
335.Nm
336checkpoints itself at the start of each tape volume.
337If writing that volume fails for some reason,
338.Nm
339will,
340with operator permission,
341restart itself from the checkpoint
342after the old tape has been rewound and removed,
343and a new tape has been mounted.
344.Pp
345The
346.Nm
347utility tells the operator what is going on at periodic intervals
348(every 5 minutes, or promptly after receiving
349.Dv SIGINFO ) ,
350including usually low estimates of the number of blocks to write,
351the number of tapes it will take, the time to completion, and
352the time to the tape change.
353The output is verbose,
354so that others know that the terminal
355controlling
356.Nm
357is busy,
358and will be for some time.
359.Pp
360In the event of a catastrophic disk event, the time required
361to restore all the necessary backup tapes or files to disk
362can be kept to a minimum by staggering the incremental dumps.
363An efficient method of staggering incremental dumps
364to minimize the number of tapes follows:
365.Bl -bullet -offset indent
366.It
367Always start with a level 0 backup, for example:
368.Bd -literal -offset indent
369/sbin/dump -0u -f /dev/nsa0 /usr/src
370.Ed
371.Pp
372This should be done at set intervals, say once a month or once every two months,
373and on a set of fresh tapes that is saved forever.
374.It
375After a level 0, dumps of active file systems are taken on a daily basis,
376using a modified Tower of Hanoi algorithm,
377with this sequence of dump levels:
378.Bd -literal -offset indent
3793 2 5 4 7 6 9 8 9 9 ...
380.Ed
381.Pp
382For the daily dumps, it should be possible to use a fixed number of tapes
383for each day, used on a weekly basis.
384Each week, a level 1 dump is taken, and
385the daily Hanoi sequence repeats beginning with 3.
386For weekly dumps, another fixed set of tapes per dumped file system is
387used, also on a cyclical basis.
388.El
389.Pp
390After several months or so, the daily and weekly tapes should get
391rotated out of the dump cycle and fresh tapes brought in.
392.Sh ENVIRONMENT
393.Bl -tag -width ".Ev TAPE"
394.It Ev TAPE
395Device from which to read backup.
396.It Ev RMT
397Pathname of the remote
398.Xr rmt 8
399program.
400.El
401.Sh FILES
402.Bl -tag -width /etc/dumpdates -compact
403.It Pa /dev/sa0
404default tape unit to dump to
405.It Pa /etc/dumpdates
406dump date records
407(this can be changed;
408see the
409.Fl D
410option)
411.It Pa /etc/fstab
412dump table: file systems and frequency
413.It Pa /etc/group
414to find group
415.Em operator
416.El
417.Sh EXIT STATUS
418Dump exits with zero status on success.
419Startup errors are indicated with an exit code of 1;
420abnormal termination is indicated with an exit code of 3.
421.Sh DIAGNOSTICS
422Many, and verbose.
423.Sh SEE ALSO
424.Xr chflags 1 ,
425.Xr fstab 5 ,
426.Xr UFS 5 ,
427.Xr restore 8 ,
428.Xr rmt 8
429.Sh HISTORY
430A
431.Nm
432utility appeared in
433.At v6 .
434.Sh BUGS
435Fewer than 32 read errors on the file system are ignored.
436.Pp
437Each reel requires a new process, so parent processes for
438reels already written just hang around until the entire tape
439is written.
440.Pp
441Currently,
442.Xr physio 9
443slices all requests into chunks of 64 KB.
444Therefore, it is
445impossible to use a larger output block size, so
446.Nm
447will prevent this from happening.
448.Pp
449The
450.Nm
451utility with the
452.Fl W
453or
454.Fl w
455options does not report file systems that have never been recorded
456in the
457.Pa dumpdates
458file,
459even if listed in
460.Pa /etc/fstab .
461.Pp
462It would be nice if
463.Nm
464knew about the dump sequence,
465kept track of the tapes scribbled on,
466told the operator which tape to mount when,
467and provided more assistance
468for the operator running
469.Xr restore 8 .
470.Pp
471The
472.Nm
473utility cannot do remote backups without being run as root, due to its
474security history.
475This may be fixed in a later version of
476.Dx .
477Presently, it works if you set it setuid (like it used to be), but this
478might constitute a security risk.
479