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