Sort ERRORS.
[netbsd-mini2440.git] / sbin / dump / dump.8
bloba10b4c1c407452cf2907ed5b1d53deaabfa6394b
1 .\"     $NetBSD: dump.8,v 1.57 2008/08/12 13:28:35 simonb Exp $
2 .\"
3 .\" Copyright (c) 1980, 1991, 1993
4 .\"      Regents of the University of California.
5 .\" All rights reserved.
6 .\"
7 .\" Redistribution and use in source and binary forms, with or without
8 .\" modification, are permitted provided that the following conditions
9 .\" are met:
10 .\" 1. Redistributions of source code must retain the above copyright
11 .\"    notice, this list of conditions and the following disclaimer.
12 .\" 2. Redistributions in binary form must reproduce the above copyright
13 .\"    notice, this list of conditions and the following disclaimer in the
14 .\"    documentation and/or other materials provided with the distribution.
15 .\" 3. Neither the name of the University nor the names of its contributors
16 .\"    may be used to endorse or promote products derived from this software
17 .\"    without specific prior written permission.
18 .\"
19 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 .\" SUCH DAMAGE.
30 .\"
31 .\"     @(#)dump.8      8.3 (Berkeley) 5/1/95
32 .\"
33 .Dd August 12, 2008
34 .Dt DUMP 8
35 .Os
36 .Sh NAME
37 .Nm dump ,
38 .Nm rdump
39 .Nd file system backup
40 .Sh SYNOPSIS
41 .Nm
42 .Op Fl 0123456789aceFnStuX
43 .Bk -words
44 .Op Fl B Ar records
45 .Ek
46 .Bk -words
47 .Op Fl b Ar blocksize
48 .Ek
49 .Bk -words
50 .Op Fl d Ar density
51 .Ek
52 .Bk -words
53 .Op Fl f Ar file
54 .Ek
55 .Bk -words
56 .Op Fl h Ar level
57 .Ek
58 .Bk -words
59 .Op Fl k Ar read-blocksize
60 .Ek
61 .Bk -words
62 .Op Fl L Ar label
63 .Ek
64 .Bk -words
65 .Op Fl l Ar timeout
66 .Ek
67 .Bk -words
68 .Op Fl r Ar cachesize
69 .Ek
70 .Bk -words
71 .Op Fl s Ar feet
72 .Ek
73 .Bk -words
74 .Op Fl T Ar date
75 .Ek
76 .Bk -words
77 .Op Fl x Ar snap-backup
78 .Ek
79 .Ar files-to-dump
80 .Nm
81 .Op Fl W Li \&| Fl w
82 .Pp
83 .in -\n[indent-synopsis]u
84 (The
85 .Bx 4.3
86 option syntax is implemented for backward compatibility, but
87 is not documented here).
88 .Sh DESCRIPTION
89 .Nm
90 examines files on a file system and determines which files need to
91 be backed up.
92 These files are copied to the given disk, tape or other storage
93 medium for safe keeping (see the
94 .Fl f
95 option below for doing remote backups).
96 A dump that is larger than the output medium is broken into
97 multiple volumes.
98 On most media the size is determined by writing until an
99 end-of-media indication is returned.
100 This can be enforced by using the
101 .Fl a
102 option.
104 On media that cannot reliably return an end-of-media indication
105 (such as some cartridge tape drives) each volume is of a fixed size;
106 the actual size is determined by the tape size and density and/or
107 block count options below.
108 By default, the same output file name is used for each volume
109 after prompting the operator to change media.
111 .Ar files-to-dump
112 is either a single file system,
113 or a list of files and directories on a single file system to be backed
114 up as a subset of the file system.
115 In the former case,
116 .Ar files-to-dump
117 may be the device of a file system,
118 the path to a currently mounted file system,
119 the path to an unmounted file system listed in
120 .Pa /etc/fstab ,
121 or, if
122 .Fl F
123 is given, a file system image.
124 In the latter case, certain restrictions are placed on the backup:
125 .Fl u
126 is ignored, the only dump level that is supported is
127 .Fl 0 ,
128 and all of the files must reside on the same file system.
130 Any files with the superuser
131 .Qq log
132 flag
133 .Pq Dv SF_LOG
134 set will be skipped.
135 These files are assumed to be
136 .Xr wapbl 4
137 journal files and will not be backed up.
139 The following options are supported by
140 .Nm :
141 .Bl -tag -width Ds
142 .It Fl 0\-9
143 Dump levels.
144 A level 0, full backup, guarantees the entire file system is copied
145 (but see also the
146 .Fl h
147 option below).
148 A level number above 0, incremental backup,
149 tells dump to copy all files new or modified since the
150 last dump of a lower level.
151 The default level is 9.
152 .It Fl a
153 .Dq auto-size .
154 Bypass all tape length considerations, and enforce writing
155 until an end-of-media indication is returned.
156 This fits best for most modern tape drives.
157 Use of this option is particularly recommended when appending to an
158 existing tape, or using a tape drive with hardware compression (where
159 you can never be sure about the compression ratio).
160 .It Fl B Ar records
161 The number of kilobytes per volume, rounded
162 down to a multiple of the blocksize.
163 This option overrides the calculation of tape size
164 based on length and density.
165 .It Fl b Ar blocksize
166 The number of kilobytes per dump record.
167 .It Fl c
168 Modify the calculation of the default density and tape size to be more
169 appropriate for cartridge tapes.
170 .It Fl d Ar density
171 Set tape density to
172 .Ar density .
173 The default is 1600 Bits Per Inch (BPI).
174 .It Fl e
175 Eject tape automatically if a tape change is required.
176 .It Fl F
177 Indicates that
178 .Ar files-to-dump
179 is a file system image.
180 .It Fl f Ar file
181 Write the backup to
182 .Ar file ;
183 .Ar file
184 may be a special device file like
185 .Pa /dev/rst0
186 (a tape drive),
187 .Pa /dev/rsd1c
188 (a disk drive),
189 an ordinary file, or
190 .Ql Fl
191 (the standard output).
192 Multiple file names may be given as a single argument separated by commas.
193 Each file will be used for one dump volume in the order listed;
194 if the dump requires more volumes than the number of names given,
195 the last file name will used for all remaining volumes after prompting
196 for media changes.
197 If the name of the file is of the form
198 .Qq host:file ,
200 .Qq user@host:file ,
202 writes to the named file on the remote host using
203 .Xr rmt 8 .
204 Note that methods more secure than
205 .Xr rsh 1
206 .Pq such as Xr ssh 1
207 can be used to invoke
208 .Xr rmt 8
209 on the remote host, via the environment variable
210 .Ev RCMD_CMD .
212 .Xr rcmd 3
213 for more details.
214 .It Fl h Ar level
215 Honor the user
216 .Qq nodump
217 flag
218 .Pq Dv UF_NODUMP
219 only for dumps at or above the given
220 .Ar level .
221 The default honor level is 1,
222 so that incremental backups omit such files
223 but full backups retain them.
224 .It Fl k Ar read-blocksize
225 The size in kilobyte of the read buffers, rounded up to a multiple of the
226 file system block size.
227 Default is 32k.
228 .It Fl l Ar timeout
229 If a tape change is required, eject the tape and wait for the drive to
230 be ready again.
231 This is to be used with tape changers which automatically load
232 the next tape when the tape is ejected.
233 If after the timeout (in seconds) the drive is not ready
235 falls back to the default behavior,
236 and prompts the operator for the next tape.
237 .It Fl L Ar label
238 The user-supplied text string
239 .Ar label
240 is placed into the dump header, where tools like
241 .Xr restore 8
243 .Xr file 1
244 can access it.
245 Note that this label is limited to be at most LBLSIZE
246 (currently 16) characters, which must include the terminating
247 .Ql \e0 .
248 .It Fl n
249 Whenever
251 requires operator attention,
252 notify all operators in the group
253 .Qq operator
254 using
255 .Xr wall 1 .
256 .It Fl r Ar cachesize
257 Use that many buffers for read cache operations.
258 A value of zero disables the read cache altogether, higher values
259 improve read performance by reading larger data blocks from the
260 disk and maintaining them in an LRU cache.
261 See the
262 .Fl k
263 option for the size of the buffers.
264 Maximum is 512, the size of the cache is
265 limited to 15% of the avail RAM by default.
266 .It Fl s Ar feet
267 Attempt to calculate the amount of tape needed
268 at a particular density.
269 If this amount is exceeded,
271 prompts for a new tape.
272 It is recommended to be a bit conservative on this option.
273 The default tape length is 2300 feet.
274 .It Fl S
275 Display an estimate of the backup size and the number of tapes
276 required, and exit without actually performing the dump.
277 .It Fl t
278 All informational log messages printed by
280 will have the time prepended to them.
281 Also, the completion time interval estimations
282 will have the estimated time at which the dump
283 will complete printed at the end of the line.
284 .It Fl T Ar date
285 Use the specified date as the starting time for the dump
286 instead of the time determined from looking in
287 .Pa /etc/dumpdates .
288 The format of date is the same as that of
289 .Xr ctime 3 .
290 This option is useful for automated dump scripts that wish to
291 dump over a specific period of time.
293 .Fl T
294 option is mutually exclusive from the
295 .Fl u
296 option.
297 .It Fl u
298 Update the file
299 .Pa /etc/dumpdates
300 after a successful dump.
301 The format of
302 .Pa /etc/dumpdates
303 is readable by people, consisting of one
304 free format record per line:
305 file system name,
306 increment level
308 .Xr ctime 3
309 format dump date.
310 There may be only one entry per file system at each level.
311 The file
312 .Pa /etc/dumpdates
313 may be edited to change any of the fields,
314 if necessary.
315 If a list of files or subdirectories is being dumped
316 (as opposed to an entire file system), then
317 .Fl u
318 is ignored.
319 .It Fl x Ar snap-backup
320 Use a snapshot with
321 .Ar snap-backup
322 as backup for this dump.
324 .Xr fss 4
325 for more details.
326 Snapshot support is
327 .Em experimental .
328 Be sure you have a backup before you use it.
329 .It Fl X
330 Similar to
331 .Fl x
332 but uses a file system internal snapshot on the file system to be dumped.
333 .It Fl W
335 tells the operator what file systems need to be dumped.
336 This information is gleaned from the files
337 .Pa /etc/dumpdates
339 .Pa /etc/fstab .
341 .Fl W
342 option causes
344 to print out, for each file system in
345 .Pa /etc/dumpdates
346 the most recent dump date and level,
347 and highlights those file systems that should be dumped.
348 If the
349 .Fl W
350 option is set, all other options are ignored, and
352 exits immediately.
353 .It Fl w
354 Is like W, but prints only those file systems which need to be dumped.
359 honors the
360 .Qq nodump
361 flag
362 .Pq Dv UF_NODUMP ,
363 files with the
364 .Qq nodump
365 flag will not be backed up.
366 If a directory has the
367 .Qq nodump
368 flag, this directory and any file or directory under it will not be backed up.
371 requires operator intervention on these conditions:
372 end of tape,
373 end of dump,
374 tape write error,
375 tape open error or
376 disk read error (if there are more than a threshold of 32).
377 In addition to alerting all operators implied by the
378 .Fl n
379 option,
381 interacts with the operator on
382 .Nm Ns 's
383 control terminal at times when
385 can no longer proceed,
386 or if something is grossly wrong.
387 All questions
389 poses
390 .Em must
391 be answered by typing
392 .Qq yes
394 .Qq no ,
395 appropriately.
397 Since making a dump involves a lot of time and effort for full dumps,
399 checkpoints itself at the start of each tape volume.
400 If writing that volume fails for some reason,
402 will,
403 with operator permission,
404 restart itself from the checkpoint
405 after the old tape has been rewound and removed,
406 and a new tape has been mounted.
409 tells the operator what is going on at periodic intervals,
410 including usually low estimates of the number of blocks to write,
411 the number of tapes it will take, the time to completion, and
412 the time to the tape change.
413 The output is verbose,
414 so that others know that the terminal
415 controlling
417 is busy,
418 and will be for some time.
420 In the event of a catastrophic disk event, the time required
421 to restore all the necessary backup tapes or files to disk
422 can be kept to a minimum by staggering the incremental dumps.
423 An efficient method of staggering incremental dumps
424 to minimize the number of tapes follows:
425 .Bl -bullet -offset indent
427 Always start with a level 0 backup, for example:
428 .Bd -literal -offset indent
429 /sbin/dump -0u -f /dev/nrst1 /usr/src
432 This should be done at set intervals, say once a month or once every two months,
433 and on a set of fresh tapes that is saved forever.
435 After a level 0, dumps of active file
436 systems are taken on a daily basis,
437 using a modified Tower of Hanoi algorithm,
438 with this sequence of dump levels:
439 .Bd -literal -offset indent
440 3 2 5 4 7 6 9 8 9 9 ...
443 For the daily dumps, it should be possible to use a fixed number of tapes
444 for each day, used on a weekly basis.
445 Each week, a level 1 dump is taken, and
446 the daily Hanoi sequence repeats beginning with 3.
447 For weekly dumps, another fixed set of tapes per dumped file system is
448 used, also on a cyclical basis.
451 After several months or so, the daily and weekly tapes should get
452 rotated out of the dump cycle and fresh tapes brought in.
456 receives a
457 .Dv SIGINFO
458 signal
459 (see the
460 .Qq status
461 argument of
462 .Xr stty 1 )
463 whilst a backup is in progress, statistics on the amount completed,
464 current transfer rate, and estimated finished time, will be written
465 to the standard error output.
466 .Sh ENVIRONMENT
467 If the following environment variables exist, they are used by
468 .Nm .
469 .Bl -tag -width Fl
470 .It Ev TAPE
471 If no -f option was specified,
473 will use the device specified via
474 .Ev TAPE
475 as the dump device.
476 .Ev TAPE
477 may be of the form
478 .Qq tapename ,
479 .Qq host:tapename ,
481 .Qq user@host:tapename .
482 .It Ev RCMD_CMD
484 will use
485 .Ev RCMD_CMD
486 rather than
487 .Xr rsh 1
488 to invoke
489 .Xr rmt 8
490 on the remote machine.
491 .It Ev TIMEFORMAT
492 can be used to control the format of the timestamps produced by the
493 .Fl t
494 option.
495 .Ev TIMEFORMAT
496 is a string containing embedded formatting commands for
497 .Xr strftime 3 .
498 The total formatted string is limited to about 80 characters, if this
499 limit is exceeded then
501 ERROR: TIMEFORMAT too long, reverting to default
503 will be printed and the time format will revert to the default one.
505 .Ev TIMEFORMAT
506 is not set then the format string defaults to
508 %T %Z
511 .Sh FILES
512 .Bl -tag -width /etc/dumpdates -compact
513 .It Pa /dev/nrst0
514 default tape unit to use.
515 Taken from
516 .Dv _PATH_DEFTAPE
518 .Pa /usr/include/paths.h .
519 .It Pa /dev/rst*
520 raw SCSI tape interface
521 .It Pa /etc/dumpdates
522 dump date records
523 .It Pa /etc/fstab
524 dump table: file systems and frequency
525 .It Pa /etc/group
526 to find group
527 .Em operator
529 .Sh DIAGNOSTICS
530 Many, and verbose.
533 exits with zero status on success.
534 Startup errors are indicated with an exit code of 1;
535 abnormal termination is indicated with an exit code of 3.
536 .Sh SEE ALSO
537 .Xr chflags 1 ,
538 .Xr rcmd 1 ,
539 .Xr stty 1 ,
540 .Xr wall 1 ,
541 .Xr fts 3 ,
542 .Xr rcmd 3 ,
543 .Xr fss 4 ,
544 .Xr st 4 ,
545 .Xr fstab 5 ,
546 .Xr environ 7 ,
547 .Xr restore 8 ,
548 .Xr rmt 8
549 .Sh HISTORY
552 command appeared in
553 .At v6 .
554 .Sh BUGS
555 Fewer than 32 read errors on the file system are ignored.
557 Each reel requires a new process, so parent processes for
558 reels already written just hang around until the entire tape
559 is written.
562 with the
563 .Fl W
565 .Fl w
566 options does not report file systems that have never been recorded
568 .Pa /etc/dumpdates ,
569 even if listed in
570 .Pa /etc/fstab .
572 When dumping a list of files or subdirectories, access privileges are
573 required to scan the directory (as this is done via the
574 .Xr fts 3
575 routines rather than directly accessing the file system).
577 It would be nice if
579 knew about the dump sequence,
580 kept track of the tapes scribbled on,
581 told the operator which tape to mount when,
582 and provided more assistance
583 for the operator running
584 .Xr restore 8 .
586 Snapshot support is
587 .Em experimental .
588 Be sure you have a backup before you use it.