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