xref: /netbsd-src/sbin/dump_lfs/dump_lfs.8 (revision 326b2259b73e878289ebd80cd9d20bc5aee35e99)
1.\"	$NetBSD: dump_lfs.8,v 1.11 2003/08/07 10:04:15 agc 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 May 26, 2003
34.Dt DUMP_LFS 8
35.Os
36.Sh NAME
37.Nm dump_lfs ,
38.Nm rdump_lfs
39.Nd filesystem backup
40.Sh SYNOPSIS
41.Nm
42.Op Fl 0123456789cnSu
43.Op Fl B Ar records
44.Op Fl b Ar blocksize
45.Op Fl d Ar density
46.Op Fl f Ar file
47.Op Fl h Ar level
48.Op Fl k Ar read blocksize
49.Op Fl L Ar label
50.Op Fl r Ar cachesize
51.Op Fl s Ar feet
52.Op Fl T Ar date
53.Ar files-to-dump
54.Nm
55.Op Fl W Li \&| Fl w
56.Pp
57.in -\n(iSu
58(The
59.Bx 4.3
60option syntax is implemented for backward compatibility, but
61is not documented here).
62.Sh DESCRIPTION
63.Nm
64examines files on a filesystem and determines which files need to
65be backed up.
66These files are copied to the given disk, tape or other storage
67medium 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.
74On media that cannot reliably return an end-of-media indication
75(such as some cartridge tape drives)
76each volume is of a fixed size;
77the actual size is determined by the tape size and density and/or
78block count options below.
79By default, the same output file name is used for each volume
80after prompting the operator to change media.
81.Pp
82.Ar files-to-dump
83is either a mountpoint of a filesystem,
84or a list of files and directories on a single filesystem to be backed
85up as a subset of the filesystem.
86In the former case, either the path to a mounted filesystem,
87or the device of an unmounted filesystem can be used.
88In the latter case, certain restrictions are placed on the backup:
89.Fl u
90is ignored, the only dump level that is supported is
91.Fl 0 ,
92and all of the files must reside on the same filesystem.
93.Pp
94The following options are supported by
95.Nm :
96.Bl -tag -width Ds
97.It Fl 0\-9
98Dump levels.
99A level 0, full backup,
100guarantees the entire file system is copied
101(but see also the
102.Fl h
103option below).
104A level number above 0,
105incremental backup,
106tells dump to
107copy all files new or modified since the
108last dump of a lower level.
109The default level is 9.
110.It Fl B Ar records
111The number of kilobytes per volume, rounded
112down to a multiple of the blocksize.
113This option overrides the calculation of tape size
114based on length and density.
115.It Fl b Ar blocksize
116The number of kilobytes per dump record.
117.It Fl c
118Modify the calculation of the default density and tape size to be more
119appropriate for cartridge tapes.
120.It Fl d Ar density
121Set tape density to
122.Ar density .
123The default is 1600 Bits Per Inch (BPI).
124.It Fl f Ar file
125Write the backup to
126.Ar file ;
127.Ar file
128may be a special device file
129like
130.Pa /dev/rst0
131(a tape drive),
132.Pa /dev/rsd1c
133(a disk drive),
134an ordinary file,
135or
136.Ql Fl
137(the standard output).
138Multiple file names may be given as a single argument separated by commas.
139Each file will be used for one dump volume in the order listed;
140if the dump requires more volumes than the number of names given,
141the last file name will used for all remaining volumes after prompting
142for media changes.
143If the name of the file is of the form
144.Qq host:file ,
145or
146.Qq user@host:file ,
147.Nm
148writes to the named file on the remote host using
149.Xr rmt 8 .
150Note that methods more secure than
151.Xr rsh 1
152.Pq such as Xr ssh 1
153can be used to invoke
154.Xr rmt 8
155on the remote host, via the environment variable
156.Ev RCMD_CMD .
157See
158.Xr rcmd 3
159for more details.
160.It Fl h Ar level
161Honor the user
162.Qq nodump
163flag
164.Pq Dv UF_NODUMP
165only for dumps at or above the given
166.Ar level .
167The default honor level is 1,
168so that incremental backups omit such files
169but full backups retain them.
170.It Fl k Ar read blocksize
171The size in kilobyte of the read buffers, rounded up to a multiple of the
172filesystem block size.
173Default is 32k.
174.It Fl L Ar label
175The user-supplied text string
176.Ar label
177is placed into the dump header, where tools like
178.Xr restore 8
179and
180.Xr file 1
181can access it.
182Note that this label is limited
183to be at most LBLSIZE (currently 16) characters, which must include
184the terminating
185.Ql \e0 .
186.It Fl n
187Whenever
188.Nm
189requires operator attention,
190notify all operators in the group
191.Qq operator
192by means similar to a
193.Xr wall 1 .
194.It Fl r Ar cachesize
195Use that many buffers for read cache operations.
196A value of zero disables the read cache altogether, higher values
197improve read performance by reading larger data blocks from the
198disk and maintaining them in an LRU cache.
199See the
200.Fl k
201option for the size of the buffers.
202Maximum is 512, the size of the cache is
203limited to 15% of the avail RAM by default.
204.It Fl s Ar feet
205Attempt to calculate the amount of tape needed
206at a particular density.
207If this amount is exceeded,
208.Nm
209prompts for a new tape.
210It is recommended to be a bit conservative on this option.
211The default tape length is 2300 feet.
212.It Fl S
213Display an estimate of the backup size and the number of tapes
214required, and exit without actually performing the dump.
215.It Fl T Ar date
216Use the specified date as the starting time for the dump
217instead of the time determined from looking in
218.Pa /etc/dumpdates .
219The format of date is the same as that of
220.Xr ctime 3 .
221This option is useful for automated dump scripts that wish to
222dump over a specific period of time.
223The
224.Fl T
225option is mutually exclusive from the
226.Fl u
227option.
228.It Fl u
229Update the file
230.Pa /etc/dumpdates
231after a successful dump.
232The format of
233.Pa /etc/dumpdates
234is readable by people, consisting of one
235free format record per line:
236filesystem name,
237increment level
238and
239.Xr ctime 3
240format dump date.
241There may be only one entry per filesystem at each level.
242The file
243.Pa /etc/dumpdates
244may be edited to change any of the fields,
245if necessary.
246If a list of files or subdirectories is being dumped
247(as opposed to and entire filesystem), then
248.Fl u
249is ignored.
250.It Fl W
251.Nm
252tells the operator what file systems need to be dumped.
253This information is gleaned from the files
254.Pa /etc/dumpdates
255and
256.Pa /etc/fstab .
257The
258.Fl W
259option causes
260.Nm
261to print out, for each file system in
262.Pa /etc/dumpdates
263the most recent dump date and level,
264and highlights those file systems that should be dumped.
265If the
266.Fl W
267option is set, all other options are ignored, and
268.Nm
269exits immediately.
270.It Fl w
271Is like W, but prints only those filesystems which need to be dumped.
272.El
273.Pp
274If
275.Nm
276honors the
277.Qq nodump
278flag
279.Pq Dv UF_NODUMP ,
280files with the
281.Qq nodump
282flag will not be backed up.
283If a directory has the
284.Qq nodump
285flag, this directory and any file or directory under it will not be backed up.
286.Pp
287.Nm
288requires operator intervention on these conditions:
289end of tape,
290end of dump,
291tape write error,
292tape open error or
293disk read error (if there are more than a threshold of 32).
294In addition to alerting all operators implied by the
295.Fl n
296option,
297.Nm
298interacts with the operator on
299.Nm Ns 's
300control terminal at times when
301.Nm
302can no longer proceed,
303or if something is grossly wrong.
304All questions
305.Nm
306poses
307.Em must
308be answered by typing
309.Qq yes
310or
311.Qq no ,
312appropriately.
313.Pp
314Since making a dump involves a lot of time and effort for full dumps,
315.Nm
316checkpoints itself at the start of each tape volume.
317If writing that volume fails for some reason,
318.Nm
319will,
320with operator permission,
321restart itself from the checkpoint
322after the old tape has been rewound and removed,
323and a new tape has been mounted.
324.Pp
325.Nm
326tells the operator what is going on at periodic intervals,
327including usually low estimates of the number of blocks to write,
328the number of tapes it will take, the time to completion, and
329the time to the tape change.
330The output is verbose,
331so that others know that the terminal
332controlling
333.Nm
334is busy,
335and will be for some time.
336.Pp
337In the event of a catastrophic disk event, the time required
338to restore all the necessary backup tapes or files to disk
339can be kept to a minimum by staggering the incremental dumps.
340An efficient method of staggering incremental dumps
341to minimize the number of tapes follows:
342.Bl -bullet -offset indent
343.It
344Always start with a level 0 backup, for example:
345.Bd -literal -offset indent
346/sbin/dump -0u -f /dev/nrst1 /usr/src
347.Ed
348.Pp
349This should be done at set intervals, say once a month or once every two months,
350and on a set of fresh tapes that is saved forever.
351.It
352After a level 0, dumps of active file
353systems are taken on a daily basis,
354using a modified Tower of Hanoi algorithm,
355with this sequence of dump levels:
356.Bd -literal -offset indent
3573 2 5 4 7 6 9 8 9 9 ...
358.Ed
359.Pp
360For the daily dumps, it should be possible to use a fixed number of tapes
361for each day, used on a weekly basis.
362Each week, a level 1 dump is taken, and
363the daily Hanoi sequence repeats beginning with 3.
364For weekly dumps, another fixed set of tapes per dumped file system is
365used, also on a cyclical basis.
366.El
367.Pp
368After several months or so, the daily and weekly tapes should get
369rotated out of the dump cycle and fresh tapes brought in.
370.Pp
371If
372.Nm
373receives a
374.Dv SIGINFO
375signal
376(see the
377.Qq status
378argument of
379.Xr stty 1 )
380whilst a backup is in progress, statistics on the amount completed,
381current transfer rate, and estimated finished time, will be written
382to the standard error output.
383.Sh ENVIRONMENT
384If the following environment variables exist, they are used by
385.Nm .
386.Bl -tag -width Fl
387.It Ev TAPE
388If no -f option was specified,
389.Nm
390will use the device specified via
391.Ev TAPE
392as the dump device.
393.Ev TAPE
394may be of the form
395.Qq tapename ,
396.Qq host:tapename ,
397or
398.Qq user@host:tapename .
399.It Ev RCMD_CMD
400.Nm
401will use
402.Ev RCMD_CMD
403rather than
404.Xr rsh 1
405to invoke
406.Xr rmt 8
407on the remote machine.
408.El
409.Sh FILES
410.Bl -tag -width /etc/dumpdates -compact
411.It Pa /dev/nrst0
412default tape unit to use.
413Taken from
414.Dv _PATH_DEFTAPE
415in
416.Pa /usr/include/paths.h .
417.It Pa /dev/rst*
418raw SCSI tape interface
419.It Pa /etc/dumpdates
420dump date records
421.It Pa /etc/fstab
422dump table: file systems and frequency
423.It Pa /etc/group
424to find group
425.Em operator
426.El
427.Sh DIAGNOSTICS
428Many, and verbose.
429.Pp
430.Nm
431exits with zero status on success.
432Startup errors are indicated with an exit code of 1;
433abnormal termination is indicated with an exit code of 3.
434.Sh SEE ALSO
435.Xr chflags 1 ,
436.Xr rcmd 1 ,
437.Xr stty 1 ,
438.Xr fts 3 ,
439.Xr rcmd 3 ,
440.Xr st 4 ,
441.Xr fstab 5 ,
442.Xr environ 7 ,
443.Xr restore 8 ,
444.Xr rmt 8
445.Sh HISTORY
446A
447.Nm
448command appeared in
449.Nx 1.5 .
450.Sh BUGS
451Fewer than 32 read errors on the filesystem are ignored.
452.Pp
453Each reel requires a new process, so parent processes for
454reels already written just hang around until the entire tape
455is written.
456.Pp
457.Nm
458with the
459.Fl W
460or
461.Fl w
462options does not report filesystems that have never been recorded
463in
464.Pa /etc/dumpdates ,
465even if listed in
466.Pa /etc/fstab .
467.Pp
468When dumping a list of files or subdirectories, access privileges are
469required to scan the directory (as this is done via the
470.Xr fts 3
471routines rather than directly accessing the filesystem).
472.Pp
473It would be nice if
474.Nm
475knew about the dump sequence,
476kept track of the tapes scribbled on,
477told the operator which tape to mount when,
478and provided more assistance
479for the operator running
480.Xr restore 8 .
481