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 0123456789acLnSu 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. 137The default block size is 10. 138.It Fl C Ar cachesize 139Specify the cache size in megabytes. 140This will greatly improve performance 141at the cost of 142.Nm 143possibly not noticing changes in the file system between passes. 144It is 145recommended that you always use this option when dumping a snapshot. 146Beware that 147.Nm 148forks, and the actual memory use may be larger than the specified cache 149size. 150The recommended cache size is between 8 and 32 (megabytes). 151.It Fl c 152Change the defaults for use with a cartridge tape drive, with a density 153of 8000 bpi, and a length of 1700 feet. 154.It Fl D Ar dumpdates 155Specify an alternate path to the 156.Pa dumpdates 157file. 158The default is 159.Pa /etc/dumpdates . 160.It Fl d Ar density 161Set tape density to 162.Ar density . 163The default is 1600BPI. 164.It Fl f Ar file 165Write the backup to 166.Ar file ; 167.Ar file 168may be a special device file 169like 170.Pa /dev/sa0 171(a tape drive), 172.Pa /dev/fd1 173(a floppy disk drive), 174an ordinary file, 175or 176.Sq Fl 177(the standard output). 178Multiple file names may be given as a single argument separated by commas. 179Each file will be used for one dump volume in the order listed; 180if the dump requires more volumes than the number of names given, 181the last file name will used for all remaining volumes after prompting 182for media changes. 183If the name of the file is of the form 184.Dq host:file , 185or 186.Dq user@host:file , 187.Nm 188writes to the named file on the remote host using 189.Xr rmt 8 . 190The default path name of the remote 191.Xr rmt 8 192program is 193.\" rmt path, is the path on the remote host 194.Pa /etc/rmt ; 195this can be overridden by the environment variable 196.Ev RMT . 197.It Fl h Ar level 198Honor the user 199.Dq nodump 200flag 201.Pq Dv UF_NODUMP 202only for dumps at or above the given 203.Ar level . 204The default honor level is 1, 205so that incremental backups omit such files 206but full backups retain them. 207.It Fl L 208This option is to notify 209.Nm 210that it is dumping a live file system. 211To obtain a consistent dump image, 212.Nm 213takes a snapshot of the file system and 214then does a dump of the snapshot. 215The snapshot is removed when the dump is complete. 216.It Fl n 217Whenever 218.Nm 219requires operator attention, 220notify all operators in the group 221.Dq operator 222by means similar to a 223.Xr wall 1 . 224.It Fl S 225Display an estimate of the backup size and the number of 226tapes required, and exit without actually performing the dump. 227.It Fl s Ar feet 228Attempt to calculate the amount of tape needed 229at a particular density. 230If this amount is exceeded, 231.Nm 232prompts for a new tape. 233It is recommended to be a bit conservative on this option. 234The default tape length is 2300 feet. 235.It Fl T Ar date 236Use the specified date as the starting time for the dump 237instead of the time determined from looking in 238the 239.Pa dumpdates 240file. 241The format of date is the same as that of 242.Xr ctime 3 . 243This option is useful for automated dump scripts that wish to 244dump over a specific period of time. 245The 246.Fl T 247option is mutually exclusive from the 248.Fl u 249option. 250.It Fl u 251Update the 252.Pa dumpdates 253file 254after a successful dump. 255The format of 256the 257.Pa dumpdates 258file 259is readable by people, consisting of one 260free format record per line: 261file system name, 262increment level 263and 264.Xr ctime 3 265format dump date. 266There may be only one entry per file system at each level. 267The 268.Pa dumpdates 269file 270may be edited to change any of the fields, 271if necessary. 272The default path for the 273.Pa dumpdates 274file is 275.Pa /etc/dumpdates , 276but the 277.Fl D 278option may be used to change it. 279.It Fl W 280Tell the operator what file systems need to be dumped. 281This information is gleaned from the files 282.Pa dumpdates 283and 284.Pa /etc/fstab . 285The 286.Fl W 287option causes 288.Nm 289to print out, for each file system in 290the 291.Pa dumpdates 292file 293the most recent dump date and level, 294and highlights those file systems that should be dumped. 295If the 296.Fl W 297option is set, all other options are ignored, and 298.Nm 299exits immediately. 300.It Fl w 301Is like 302.Fl W , 303but prints only those file systems which need to be dumped. 304.El 305.Pp 306Directories and regular files which have their 307.Dq nodump 308flag 309.Pq Dv UF_NODUMP 310set will be omitted along with everything under such directories, 311subject to the 312.Fl h 313option. 314.Pp 315The 316.Nm 317utility requires operator intervention on these conditions: 318end of tape, 319end of dump, 320tape write error, 321tape open error or 322disk read error (if there are more than a threshold of 32). 323In addition to alerting all operators implied by the 324.Fl n 325key, 326.Nm 327interacts with the operator on 328.Em dump's 329control terminal at times when 330.Nm 331can no longer proceed, 332or if something is grossly wrong. 333All questions 334.Nm 335poses 336.Em must 337be answered by typing 338.Dq yes 339or 340.Dq no , 341appropriately. 342.Pp 343Since making a dump involves a lot of time and effort for full dumps, 344.Nm 345checkpoints itself at the start of each tape volume. 346If writing that volume fails for some reason, 347.Nm 348will, 349with operator permission, 350restart itself from the checkpoint 351after the old tape has been rewound and removed, 352and a new tape has been mounted. 353.Pp 354The 355.Nm 356utility tells the operator what is going on at periodic intervals 357(every 5 minutes, or promptly after receiving 358.Dv SIGINFO ) , 359including usually low estimates of the number of blocks to write, 360the number of tapes it will take, the time to completion, and 361the time to the tape change. 362The output is verbose, 363so that others know that the terminal 364controlling 365.Nm 366is busy, 367and will be for some time. 368.Pp 369In the event of a catastrophic disk event, the time required 370to restore all the necessary backup tapes or files to disk 371can be kept to a minimum by staggering the incremental dumps. 372An efficient method of staggering incremental dumps 373to minimize the number of tapes follows: 374.Bl -bullet -offset indent 375.It 376Always start with a level 0 backup, for example: 377.Bd -literal -offset indent 378/sbin/dump -0u -f /dev/nsa0 /usr/src 379.Ed 380.Pp 381This should be done at set intervals, say once a month or once every two months, 382and on a set of fresh tapes that is saved forever. 383.It 384After a level 0, dumps of active file systems are taken on a daily basis, 385using a modified Tower of Hanoi algorithm, 386with this sequence of dump levels: 387.Bd -literal -offset indent 3883 2 5 4 7 6 9 8 9 9 ... 389.Ed 390.Pp 391For the daily dumps, it should be possible to use a fixed number of tapes 392for each day, used on a weekly basis. 393Each week, a level 1 dump is taken, and 394the daily Hanoi sequence repeats beginning with 3. 395For weekly dumps, another fixed set of tapes per dumped file system is 396used, also on a cyclical basis. 397.El 398.Pp 399After several months or so, the daily and weekly tapes should get 400rotated out of the dump cycle and fresh tapes brought in. 401.Sh ENVIRONMENT 402.Bl -tag -width ".Ev TAPE" 403.It Ev TAPE 404Device from which to read backup. 405.It Ev RMT 406Pathname of the remote 407.Xr rmt 8 408program. 409.El 410.Sh FILES 411.Bl -tag -width /etc/dumpdates -compact 412.It Pa /dev/sa0 413default tape unit to dump to 414.It Pa /etc/dumpdates 415dump date records 416(this can be changed; 417see the 418.Fl D 419option) 420.It Pa /etc/fstab 421dump table: file systems and frequency 422.It Pa /etc/group 423to find group 424.Em operator 425.El 426.Sh SEE ALSO 427.Xr chflags 1 , 428.Xr fstab 5 , 429.Xr restore 8 , 430.Xr rmt 8 431.Sh DIAGNOSTICS 432Many, and verbose. 433.Pp 434Dump exits with zero status on success. 435Startup errors are indicated with an exit code of 1; 436abnormal termination is indicated with an exit code of 3. 437.Sh BUGS 438Fewer than 32 read errors on the file system are ignored. 439.Pp 440Each reel requires a new process, so parent processes for 441reels already written just hang around until the entire tape 442is written. 443.Pp 444The 445.Nm 446utility with the 447.Fl W 448or 449.Fl w 450options does not report file systems that have never been recorded 451in the 452.Pa dumpdates 453file, 454even if listed in 455.Pa /etc/fstab . 456.Pp 457It would be nice if 458.Nm 459knew about the dump sequence, 460kept track of the tapes scribbled on, 461told the operator which tape to mount when, 462and provided more assistance 463for the operator running 464.Xr restore 8 . 465.Pp 466The 467.Nm 468utility cannot do remote backups without being run as root, due to its 469security history. 470This will be fixed in a later version of 471.Fx . 472Presently, it works if you set it setuid (like it used to be), but this 473might constitute a security risk. 474.Sh HISTORY 475A 476.Nm 477utility appeared in 478.At v6 . 479