1.\" $NetBSD: dump.8,v 1.17 1997/06/05 11:15:06 lukem 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.1 (Berkeley) 6/16/93 36.\" 37.Dd June 4, 1997 38.Dt DUMP 8 39.Os BSD 4 40.Sh NAME 41.Nm dump 42.Nd filesystem backup 43.Sh SYNOPSIS 44.Nm 45.Op Fl 0123456789cnu 46.Op Fl B Ar records 47.Op Fl b Ar blocksize 48.Op Fl d Ar density 49.Op Fl f Ar file 50.Op Fl h Ar level 51.Op Fl s Ar feet 52.Op Fl T Ar date 53.Ar files-to-dump 54.Nm dump 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 65on a filesystem 66and determines which files 67need to be backed up. These files 68are copied to the given disk, tape or other 69storage medium for safe keeping (see the 70.Fl f 71option below for doing remote backups). 72A dump that is larger than the output medium is broken into 73multiple volumes. 74On most media the size is determined by writing until an 75end-of-media indication is returned. 76On media that cannot reliably return an end-of-media indication 77(such as some cartridge tape drives) 78each volume is of a fixed size; 79the actual size is determined by the tape size and density and/or 80block count options below. 81By default, the same output file name is used for each volume 82after prompting the operator to change media. 83.Pp 84.Ar files-to-dump 85is either a mountpoint of a filesystem, 86or a list of files and directories on a single filesystem to be backed 87up as a subset of the filesystem. 88In the former case, either the path to a mounted filesystem, 89or the device of an unmounted filesystem can be used. 90In the latter case, certain restrictions are placed on the backup: 91.Fl u 92is ignored, the only dump level that is supported is 93.Fl 0 , 94and all of the files must reside on the same filesystem. 95.Pp 96The following options are supported by 97.Nm dump : 98.Bl -tag -width Ds 99.It Fl 0\-9 100Dump levels. 101A level 0, full backup, 102guarantees the entire file system is copied 103(but see also the 104.Fl h 105option below). 106A level number above 0, 107incremental backup, 108tells dump to 109copy all files new or modified since the 110last dump of the same or lower level. 111The default level is 9. 112.It Fl B Ar records 113The number of kilobytes per volume, rounded 114down to a multiple of the blocksize. 115This option overrides the calculation of tape size 116based on length and density. 117.It Fl b Ar blocksize 118The number of kilobytes per dump record. 119.It Fl c 120Modify the calculation of the default density and tape size to be more 121appropriate for cartridge tapes. 122.It Fl d Ar density 123Set tape density to 124.Ar density . 125The default is 1600BPI. 126.It Fl f Ar file 127Write the backup to 128.Ar file ; 129.Ar file 130may be a special device file 131like 132.Pa /dev/rst0 133(a tape drive), 134.Pa /dev/rsd1c 135(a disk drive), 136an ordinary file, 137or 138.Ql Fl 139(the standard output). 140Multiple file names may be given as a single argument separated by commas. 141Each file will be used for one dump volume in the order listed; 142if the dump requires more volumes than the number of names given, 143the last file name will used for all remaining volumes after prompting 144for media changes. 145If the name of the file is of the form 146.Dq host:file , 147or 148.Dq user@host:file , 149.Nm 150writes to the named file on the remote host using 151.Xr rmt 8 . 152.It Fl h Ar level 153Honor the user 154.Dq nodump 155flag 156.Dp Dv UF_NODUMP 157only for dumps at or above the given 158.Ar level . 159The default honor level is 1, 160so that incremental backups omit such files 161but full backups retain them. 162.It Fl n 163Whenever 164.Nm 165requires operator attention, 166notify all operators in the group 167.Dq operator 168by means similar to a 169.Xr wall 1 . 170.It Fl s Ar feet 171Attempt to calculate the amount of tape needed 172at a particular density. 173If this amount is exceeded, 174.Nm 175prompts for a new tape. 176It is recommended to be a bit conservative on this option. 177The default tape length is 2300 feet. 178.It Fl T Ar date 179Use the specified date as the starting time for the dump 180instead of the time determined from looking in 181.Pa /etc/dumpdates . 182The format of date is the same as that of 183.Xr ctime 3 . 184This option is useful for automated dump scripts that wish to 185dump over a specific period of time. 186The 187.Fl T 188flag is mutually exclusive from the 189.Fl u 190flag. 191.It Fl u 192Update the file 193.Pa /etc/dumpdates 194after a successful dump. 195The format of 196.Pa /etc/dumpdates 197is readable by people, consisting of one 198free format record per line: 199filesystem name, 200increment level 201and 202.Xr ctime 3 203format dump date. 204There may be only one entry per filesystem at each level. 205The file 206.Pa /etc/dumpdates 207may be edited to change any of the fields, 208if necessary. 209If a list of files or subdirectories is being dumped 210(as opposed to and entire filesystem), then 211.Fl u 212is ignored. 213.It Fl W 214.Nm 215tells the operator what file systems need to be dumped. 216This information is gleaned from the files 217.Pa /etc/dumpdates 218and 219.Pa /etc/fstab . 220The 221.Fl W 222flag causes 223.Nm 224to print out, for each file system in 225.Pa /etc/dumpdates 226the most recent dump date and level, 227and highlights those file systems that should be dumped. 228If the 229.Fl W 230flag is set, all other options are ignored, and 231.Nm 232exits immediately. 233.It Fl w 234Is like W, but prints only those filesystems which need to be dumped. 235.El 236.Pp 237.Nm 238requires operator intervention on these conditions: 239end of tape, 240end of dump, 241tape write error, 242tape open error or 243disk read error (if there are more than a threshold of 32). 244In addition to alerting all operators implied by the 245.Fl n 246flag, 247.Nm 248interacts with the operator on 249.Nm dump Ns 's 250control terminal at times when 251.Nm 252can no longer proceed, 253or if something is grossly wrong. 254All questions 255.Nm 256poses 257.Em must 258be answered by typing 259.Dq yes 260or 261.Dq no , 262appropriately. 263.Pp 264Since making a dump involves a lot of time and effort for full dumps, 265.Nm 266checkpoints itself at the start of each tape volume. 267If writing that volume fails for some reason, 268.Nm 269will, 270with operator permission, 271restart itself from the checkpoint 272after the old tape has been rewound and removed, 273and a new tape has been mounted. 274.Pp 275.Nm 276tells the operator what is going on at periodic intervals, 277including usually low estimates of the number of blocks to write, 278the number of tapes it will take, the time to completion, and 279the time to the tape change. 280The output is verbose, 281so that others know that the terminal 282controlling 283.Nm 284is busy, 285and will be for some time. 286.Pp 287In the event of a catastrophic disk event, the time required 288to restore all the necessary backup tapes or files to disk 289can be kept to a minimum by staggering the incremental dumps. 290An efficient method of staggering incremental dumps 291to minimize the number of tapes follows: 292.Bl -bullet -offset indent 293.It 294Always start with a level 0 backup, for example: 295.Bd -literal -offset indent 296/sbin/dump -0u -f /dev/nrst1 /usr/src 297.Ed 298.Pp 299This should be done at set intervals, say once a month or once every two months, 300and on a set of fresh tapes that is saved forever. 301.It 302After a level 0, dumps of active file 303systems are taken on a daily basis, 304using a modified Tower of Hanoi algorithm, 305with this sequence of dump levels: 306.Bd -literal -offset indent 3073 2 5 4 7 6 9 8 9 9 ... 308.Ed 309.Pp 310For the daily dumps, it should be possible to use a fixed number of tapes 311for each day, used on a weekly basis. 312Each week, a level 1 dump is taken, and 313the daily Hanoi sequence repeats beginning with 3. 314For weekly dumps, another fixed set of tapes per dumped file system is 315used, also on a cyclical basis. 316.El 317.Pp 318After several months or so, the daily and weekly tapes should get 319rotated out of the dump cycle and fresh tapes brought in. 320.Pp 321If 322.Nm 323receives a 324.Dv SIGINFO 325signal 326(see the 327.Dq status 328argument of 329.Xr stty 1 ) 330whilst a backup is in progress, statistics on the amount completed, 331current transfer rate, and estimated finished time, will be written 332to the standard error output. 333.Sh FILES 334.Bl -tag -width /etc/dumpdates -compact 335.It Pa /dev/rst0 336default tape unit to dump to 337.It Pa /dev/rst* 338Raw SCSI tape interface 339.It Pa /etc/dumpdates 340dump date records 341.It Pa /etc/fstab 342dump table: file systems and frequency 343.It Pa /etc/group 344to find group 345.Em operator 346.El 347.Sh SEE ALSO 348.Xr stty 1 , 349.Xr fts 3 , 350.Xr fstab 5 , 351.Xr restore 8 , 352.Xr rmt 8 353.Sh DIAGNOSTICS 354Many, and verbose. 355.Pp 356.Nm 357exits with zero status on success. 358Startup errors are indicated with an exit code of 1; 359abnormal termination is indicated with an exit code of 3. 360.Sh BUGS 361Fewer than 32 read errors on the filesystem are ignored. 362.Pp 363Each reel requires a new process, so parent processes for 364reels already written just hang around until the entire tape 365is written. 366.Pp 367.Nm 368with the 369.Fl W 370or 371.Fl w 372flags does not report filesystems that have never been recorded 373in 374.Pa /etc/dumpdates , 375even if listed in 376.Pa /etc/fstab . 377.Pp 378When dumping a list of files or subdirectories, access privileges are 379required to scan the directory (as this is done via the 380.Xr fts 3 381routines rather than directly accessing the filesystem). 382.Pp 383It would be nice if 384.Nm 385knew about the dump sequence, 386kept track of the tapes scribbled on, 387told the operator which tape to mount when, 388and provided more assistance 389for the operator running 390.Xr restore . 391.Sh HISTORY 392A 393.Nm 394command appeared in Version 6 AT&T UNIX. 395