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