]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sbin/dump/dump.8
This commit was generated by cvs2svn to compensate for changes in r145857,
[FreeBSD/FreeBSD.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 .\" 4. Neither the name of the University nor the names of its contributors
14 .\"    may be used to endorse or promote products derived from this software
15 .\"    without specific prior written permission.
16 .\"
17 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
18 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
21 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 .\" SUCH DAMAGE.
28 .\"
29 .\"     @(#)dump.8      8.3 (Berkeley) 5/1/95
30 .\" $FreeBSD$
31 .\"
32 .Dd March 1, 2002
33 .Dt DUMP 8
34 .Os
35 .Sh NAME
36 .Nm dump ,
37 .Nm rdump
38 .Nd file system backup
39 .Sh SYNOPSIS
40 .Nm
41 .Op Fl 0123456789acLnSu
42 .Op Fl B Ar records
43 .Op Fl b Ar blocksize
44 .Op Fl C Ar cachesize
45 .Op Fl D Ar dumpdates
46 .Op Fl d Ar density
47 .Op Fl f Ar file | Fl P Ar pipecommand
48 .Op Fl h Ar level
49 .Op Fl s Ar feet
50 .Op Fl T Ar date
51 .Ar filesystem
52 .Nm
53 .Fl W | Fl w
54 .Pp
55 .Nm rdump
56 is an alternate name for
57 .Nm .
58 .Pp
59 .in \" XXX
60 (The
61 .Bx 4.3
62 option syntax is implemented for backward compatibility, but
63 is not documented here.)
64 .Sh DESCRIPTION
65 The
66 .Nm
67 utility examines files
68 on a file system
69 and determines which files
70 need to be backed up.
71 These files
72 are copied to the given disk, tape or other
73 storage medium for safe keeping (see the
74 .Fl f
75 option below for doing remote backups).
76 A dump that is larger than the output medium is broken into
77 multiple volumes.
78 On most media the size is determined by writing until an
79 end-of-media indication is returned.
80 This can be enforced
81 by using the
82 .Fl a
83 option.
84 .Pp
85 On media that cannot reliably return an end-of-media indication
86 (such as some cartridge tape drives)
87 each volume is of a fixed size;
88 the actual size is determined by the tape size and density and/or
89 .Fl B
90 options.
91 By default, the same output file name is used for each volume
92 after prompting the operator to change media.
93 .Pp
94 The file system to be dumped is specified by the argument
95 .Ar filesystem
96 as either its device-special file or its mount point
97 (if that is in a standard entry in
98 .Pa /etc/fstab ) .
99 .Pp
100 The following options are supported by
101 .Nm :
102 .Bl -tag -width Ds
103 .It Fl 0-9
104 Dump levels.
105 A level 0, full backup,
106 guarantees the entire file system is copied
107 (but see also the
108 .Fl h
109 option below).
110 A level number above 0,
111 incremental backup,
112 tells dump to
113 copy all files new or modified since the
114 last dump of any lower level.
115 The default level is 0.
116 .It Fl a
117 .Dq auto-size .
118 Bypass all tape length considerations, and enforce writing
119 until an end-of-media indication is returned.
120 This fits best for most modern tape drives.
121 Use of this option is particularly
122 recommended when appending to an existing tape, or using a tape
123 drive with hardware compression (where you can never be sure about
124 the compression ratio).
125 .It Fl B Ar records
126 The number of kilobytes per output volume, except that if it is
127 not an integer multiple of the output block size,
128 the command uses the next smaller such multiple.
129 This option overrides the calculation of tape size
130 based on length and density.
131 .It Fl b Ar blocksize
132 The number of kilobytes per output block.
133 The default block size is 10.
134 .It Fl C Ar cachesize
135 Specify the cache size in megabytes.
136 This will greatly improve performance
137 at the cost of
138 .Nm
139 possibly not noticing changes in the file system between passes.
140 It is
141 recommended that you always use this option when dumping a snapshot.
142 Beware that
143 .Nm
144 forks, and the actual memory use may be larger than the specified cache
145 size.
146 The recommended cache size is between 8 and 32 (megabytes).
147 .It Fl c
148 Change the defaults for use with a cartridge tape drive, with a density
149 of 8000 bpi, and a length of 1700 feet.
150 .It Fl D Ar dumpdates
151 Specify an alternate path to the
152 .Pa dumpdates
153 file.
154 The default is
155 .Pa /etc/dumpdates .
156 .It Fl d Ar density
157 Set tape density to
158 .Ar density .
159 The default is 1600BPI.
160 .It Fl f Ar file
161 Write the backup to
162 .Ar file ;
163 .Ar file
164 may be a special device file
165 like
166 .Pa /dev/sa0
167 (a tape drive),
168 .Pa /dev/fd1
169 (a floppy disk drive),
170 an ordinary file,
171 or
172 .Sq Fl
173 (the standard output).
174 Multiple file names may be given as a single argument separated by commas.
175 Each file will be used for one dump volume in the order listed;
176 if the dump requires more volumes than the number of names given,
177 the last file name will used for all remaining volumes after prompting
178 for media changes.
179 If the name of the file is of the form
180 .Dq host:file ,
181 or
182 .Dq user@host:file ,
183 .Nm
184 writes to the named file on the remote host using
185 .Xr rmt 8 .
186 The default path name of the remote
187 .Xr rmt 8
188 program is
189 .\" rmt path, is the path on the remote host
190 .Pa /etc/rmt ;
191 this can be overridden by the environment variable
192 .Ev RMT .
193 .It Fl P Ar pipecommand
194 Use
195 .Xr popen 3
196 to execute the
197 .Xr sh 1
198 script string defined by
199 .Ar pipecommand
200 for the output device of each volume.
201 This child pipeline's
202 .Dv stdin
203 .Pq Pa /dev/fd/0
204 is redirected from the
205 .Nm
206 output stream, and the environment variable
207 .Ev DUMP_VOLUME
208 is set to the current volume number being written.
209 After every volume, the writer side of the pipe is closed and
210 .Ar pipecommand
211 is executed again.
212 Subject to the media size specified by
213 .Fl B ,
214 each volume is written in this manner as if the output were a tape drive.
215 .It Fl h Ar level
216 Honor the user
217 .Dq nodump
218 flag
219 .Pq Dv UF_NODUMP
220 only for dumps at or above the given
221 .Ar level .
222 The default honor level is 1,
223 so that incremental backups omit such files
224 but full backups retain them.
225 .It Fl L
226 This option is to notify
227 .Nm
228 that it is dumping a live file system.
229 To obtain a consistent dump image,
230 .Nm
231 takes a snapshot of the file system in the
232 .Pa .snap
233 directory in the root of the file system being dumped and
234 then does a dump of the snapshot.
235 The snapshot is removed when the dump is complete.
236 This option is ignored for unmounted or read-only file systems.
237 If the
238 .Pa .snap
239 directory does not exist in the root of the file system being dumped,
240 a warning will be issued and the
241 .Nm
242 will revert to the standard behavior.
243 This problem can be corrected by creating a
244 .Pa .snap
245 directory in the root of the file system to be dumped;
246 its owner should be
247 .Dq Li root ,
248 its group should be
249 .Dq Li operator ,
250 and its mode should be
251 .Dq Li 0770 .
252 .It Fl n
253 Whenever
254 .Nm
255 requires operator attention,
256 notify all operators in the group
257 .Dq operator
258 by means similar to a
259 .Xr wall 1 .
260 .It Fl S
261 Display an estimate of the backup size and the number of
262 tapes required, and exit without actually performing the dump.
263 .It Fl s Ar feet
264 Attempt to calculate the amount of tape needed
265 at a particular density.
266 If this amount is exceeded,
267 .Nm
268 prompts for a new tape.
269 It is recommended to be a bit conservative on this option.
270 The default tape length is 2300 feet.
271 .It Fl T Ar date
272 Use the specified date as the starting time for the dump
273 instead of the time determined from looking in
274 a warning will be issued and the
275 .Pa dumpdates
276 file.
277 The format of date is the same as that of
278 .Xr ctime 3 .
279 This option is useful for automated dump scripts that wish to
280 dump over a specific period of time.
281 The
282 .Fl T
283 option is mutually exclusive from the
284 .Fl u
285 option.
286 .It Fl u
287 Update the
288 .Pa dumpdates
289 file
290 after a successful dump.
291 The format of
292 the
293 .Pa dumpdates
294 file
295 is readable by people, consisting of one
296 free format record per line:
297 file system name,
298 increment level
299 and
300 .Xr ctime 3
301 format dump date.
302 There may be only one entry per file system at each level.
303 The
304 .Pa dumpdates
305 file
306 may be edited to change any of the fields,
307 if necessary.
308 The default path for the
309 .Pa dumpdates
310 file is
311 .Pa /etc/dumpdates ,
312 but the
313 .Fl D
314 option may be used to change it.
315 .It Fl W
316 Tell the operator what file systems need to be dumped.
317 This information is gleaned from the files
318 .Pa dumpdates
319 and
320 .Pa /etc/fstab .
321 The
322 .Fl W
323 option causes
324 .Nm
325 to print out, for each file system in
326 the
327 .Pa dumpdates
328 file
329 the most recent dump date and level,
330 and highlights those file systems that should be dumped.
331 If the
332 .Fl W
333 option is set, all other options are ignored, and
334 .Nm
335 exits immediately.
336 .It Fl w
337 Is like
338 .Fl W ,
339 but prints only those file systems which need to be dumped.
340 .El
341 .Pp
342 Directories and regular files which have their
343 .Dq nodump
344 flag
345 .Pq Dv UF_NODUMP
346 set will be omitted along with everything under such directories,
347 subject to the
348 .Fl h
349 option.
350 .Pp
351 The
352 .Nm
353 utility requires operator intervention on these conditions:
354 end of tape,
355 end of dump,
356 tape write error,
357 tape open error or
358 disk read error (if there are more than a threshold of 32).
359 In addition to alerting all operators implied by the
360 .Fl n
361 key,
362 .Nm
363 interacts with the operator on
364 .Em dump's
365 control terminal at times when
366 .Nm
367 can no longer proceed,
368 or if something is grossly wrong.
369 All questions
370 .Nm
371 poses
372 .Em must
373 be answered by typing
374 .Dq yes
375 or
376 .Dq no ,
377 appropriately.
378 .Pp
379 Since making a dump involves a lot of time and effort for full dumps,
380 .Nm
381 checkpoints itself at the start of each tape volume.
382 If writing that volume fails for some reason,
383 .Nm
384 will,
385 with operator permission,
386 restart itself from the checkpoint
387 after the old tape has been rewound and removed,
388 and a new tape has been mounted.
389 .Pp
390 The
391 .Nm
392 utility tells the operator what is going on at periodic intervals
393 (every 5 minutes, or promptly after receiving
394 .Dv SIGINFO ) ,
395 including usually low estimates of the number of blocks to write,
396 the number of tapes it will take, the time to completion, and
397 the time to the tape change.
398 The output is verbose,
399 so that others know that the terminal
400 controlling
401 .Nm
402 is busy,
403 and will be for some time.
404 .Pp
405 In the event of a catastrophic disk event, the time required
406 to restore all the necessary backup tapes or files to disk
407 can be kept to a minimum by staggering the incremental dumps.
408 An efficient method of staggering incremental dumps
409 to minimize the number of tapes follows:
410 .Bl -bullet -offset indent
411 .It
412 Always start with a level 0 backup, for example:
413 .Bd -literal -offset indent
414 /sbin/dump -0u -f /dev/nsa0 /usr/src
415 .Ed
416 .Pp
417 This should be done at set intervals, say once a month or once every two months,
418 and on a set of fresh tapes that is saved forever.
419 .It
420 After a level 0, dumps of active file systems (file systems with files
421 that change, depending on your partition layout some file systems may
422 contain only data that does not change) are taken on a daily basis,
423 using a modified Tower of Hanoi algorithm,
424 with this sequence of dump levels:
425 .Bd -literal -offset indent
426 3 2 5 4 7 6 9 8 9 9 ...
427 .Ed
428 .Pp
429 For the daily dumps, it should be possible to use a fixed number of tapes
430 for each day, used on a weekly basis.
431 Each week, a level 1 dump is taken, and
432 the daily Hanoi sequence repeats beginning with 3.
433 For weekly dumps, another fixed set of tapes per dumped file system is
434 used, also on a cyclical basis.
435 .El
436 .Pp
437 After several months or so, the daily and weekly tapes should get
438 rotated out of the dump cycle and fresh tapes brought in.
439 .Sh ENVIRONMENT
440 .Bl -tag -width ".Ev TAPE"
441 .It Ev TAPE
442 Device from which to read backup.
443 .It Ev RMT
444 Pathname of the remote
445 .Xr rmt 8
446 program.
447 .It Ev RSH
448 Pathname of a remote shell program, if not
449 .Xr rsh 1 .
450 .El
451 .Sh FILES
452 .Bl -tag -width /etc/dumpdates -compact
453 .It Pa /dev/sa0
454 default tape unit to dump to
455 .It Pa /etc/dumpdates
456 dump date records
457 (this can be changed;
458 see the
459 .Fl D
460 option)
461 .It Pa /etc/fstab
462 dump table: file systems and frequency
463 .It Pa /etc/group
464 to find group
465 .Em operator
466 .El
467 .Sh EXIT STATUS
468 Dump exits with zero status on success.
469 Startup errors are indicated with an exit code of 1;
470 abnormal termination is indicated with an exit code of 3.
471 .Sh DIAGNOSTICS
472 Many, and verbose.
473 .Sh SEE ALSO
474 .Xr chflags 1 ,
475 .Xr fstab 5 ,
476 .Xr restore 8 ,
477 .Xr rmt 8
478 .Sh HISTORY
479 A
480 .Nm
481 utility appeared in
482 .At v6 .
483 .Sh BUGS
484 Fewer than 32 read errors on the file system are ignored, though all
485 errors will generate a warning message.
486 This is a bit of a compromise.
487 In practice, it is possible to generate read errors when doing dumps
488 on mounted partitions if the file system is being modified while the
489 .Nm
490 is running.
491 Since dumps are often done in an unattended fashion using
492 .Xr cron 8
493 jobs asking for Operator intervention would result in the
494 .Nm
495 dying.
496 However, there is nothing wrong with a dump tape written when this sort
497 of read error occurs, and there is no reason to terminate the
498 .Nm .
499 .Pp
500 Each reel requires a new process, so parent processes for
501 reels already written just hang around until the entire tape
502 is written.
503 .Pp
504 The
505 .Nm
506 utility with the
507 .Fl W
508 or
509 .Fl w
510 options does not report file systems that have never been recorded
511 in the
512 .Pa dumpdates
513 file,
514 even if listed in
515 .Pa /etc/fstab .
516 .Pp
517 It would be nice if
518 .Nm
519 knew about the dump sequence,
520 kept track of the tapes scribbled on,
521 told the operator which tape to mount when,
522 and provided more assistance
523 for the operator running
524 .Xr restore 8 .
525 .Pp
526 The
527 .Nm
528 utility cannot do remote backups without being run as root, due to its
529 security history.
530 This will be fixed in a later version of
531 .Fx .
532 Presently, it works if you set it setuid (like it used to be), but this
533 might constitute a security risk.