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