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