1.\" $NetBSD: dump.8,v 1.47 2002/02/26 02:00:16 wiz 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.3 (Berkeley) 5/1/95 36.\" 37.Dd December 30, 2001 38.Dt DUMP 8 39.Os 40.Sh NAME 41.Nm dump , 42.Nm rdump 43.Nd file system backup 44.Sh SYNOPSIS 45.Nm "" 46.Op Fl 0123456789aceFnStu 47.Bk -words 48.Op Fl B Ar records 49.Ek 50.Bk -words 51.Op Fl b Ar blocksize 52.Ek 53.Bk -words 54.Op Fl d Ar density 55.Ek 56.Bk -words 57.Op Fl f Ar file 58.Ek 59.Bk -words 60.Op Fl h Ar level 61.Ek 62.Bk -words 63.Op Fl k Ar read-blocksize 64.Ek 65.Bk -words 66.Op Fl L Ar label 67.Ek 68.Bk -words 69.Op Fl l Ar timeout 70.Ek 71.Bk -words 72.Op Fl r Ar cachesize 73.Ek 74.Bk -words 75.Op Fl s Ar feet 76.Ek 77.Bk -words 78.Op Fl T Ar date 79.Ek 80.Ar files-to-dump 81.Nm "" 82.Op Fl W Li \&| Fl w 83.Pp 84.in -\n(iSu 85(The 86.Bx 4.3 87option syntax is implemented for backward compatibility, but 88is not documented here). 89.Sh DESCRIPTION 90.Nm 91examines files on a file system and determines which files need to 92be backed up. 93These files are copied to the given disk, tape or other storage 94medium for safe keeping (see the 95.Fl f 96option below for doing remote backups). 97A dump that is larger than the output medium is broken into 98multiple volumes. 99On most media the size is determined by writing until an 100end-of-media indication is returned. 101This can be enforced 102by using the 103.Fl a 104option. 105.Pp 106On media that cannot reliably return an end-of-media indication 107(such as some cartridge tape drives) 108each volume is of a fixed size; 109the actual size is determined by the tape size and density and/or 110block count options below. 111By default, the same output file name is used for each volume 112after prompting the operator to change media. 113.Pp 114.Ar files-to-dump 115is either a single file system, 116or a list of files and directories on a single file system to be backed 117up as a subset of the file system. 118In the former case, 119.Ar files-to-dump 120may be the device of a file system, 121the path to a currently mounted file system, 122the path to an unmounted file system listed in 123.Pa /etc/fstab , 124or, if 125.Fl F 126is given, a file system image. 127In the latter case, certain restrictions are placed on the backup: 128.Fl u 129is ignored, the only dump level that is supported is 130.Fl 0 , 131and all of the files must reside on the same file system. 132.Pp 133The following options are supported by 134.Nm "" : 135.Bl -tag -width Ds 136.It Fl 0\-9 137Dump levels. 138A level 0, full backup, 139guarantees the entire file system is copied 140(but see also the 141.Fl h 142option below). 143A level number above 0, 144incremental backup, 145tells dump to 146copy all files new or modified since the 147last dump of a lower level. 148The default level is 9. 149.It Fl a 150.Dq auto-size . 151Bypass all tape length considerations, and enforce writing 152until an end-of-media indication is returned. 153This fits best for most modern tape drives. 154Use of this option is particularly recommended when appending to an 155existing tape, or using a tape drive with hardware compression (where 156you can never be sure about the compression ratio). 157.It Fl B Ar records 158The number of kilobytes per volume, rounded 159down to a multiple of the blocksize. 160This option overrides the calculation of tape size 161based on length and density. 162.It Fl b Ar blocksize 163The number of kilobytes per dump record. 164.It Fl c 165Modify the calculation of the default density and tape size to be more 166appropriate for cartridge tapes. 167.It Fl d Ar density 168Set tape density to 169.Ar density . 170The default is 1600 Bits Per Inch (BPI). 171.It Fl e 172Eject tape automatically if a tape change is required. 173.It Fl F 174Indicates that 175.Ar files-to-dump 176is a file system image. 177.It Fl f Ar file 178Write the backup to 179.Ar file ; 180.Ar file 181may be a special device file 182like 183.Pa /dev/rst0 184(a tape drive), 185.Pa /dev/rsd1c 186(a disk drive), 187an ordinary file, 188or 189.Ql Fl 190(the standard output). 191Multiple file names may be given as a single argument separated by commas. 192Each file will be used for one dump volume in the order listed; 193if the dump requires more volumes than the number of names given, 194the last file name will used for all remaining volumes after prompting 195for media changes. 196If the name of the file is of the form 197.Qq host:file , 198or 199.Qq user@host:file , 200.Nm 201writes to the named file on the remote host using 202.Xr rmt 8 . 203Note that methods more secure than 204.Xr rsh 1 205.Pq such as Xr ssh 1 206can be used to invoke 207.Xr rmt 8 208on the remote host, via the environment variable 209.Ev RCMD_CMD . 210See 211.Xr rcmd 3 212for more details. 213.It Fl h Ar level 214Honor the user 215.Qq nodump 216flag 217.Pq Dv UF_NODUMP 218only for dumps at or above the given 219.Ar level . 220The default honor level is 1, 221so that incremental backups omit such files 222but full backups retain them. 223.It Fl k Ar read blocksize 224The size in kilobyte of the read buffers, rounded up to a multiple of the 225file system block size. Default is 32k. 226.It Fl l Ar timeout 227If a tape change is required, eject the tape and wait for the drive to 228be ready again. This is to be used with tape changers which automatically load 229the next tape when the tape is ejected. If after the timeout (in seconds) the 230drive is not ready 231.Nm 232falls back to the default behavior, and prompts the operator for the next 233tape. 234.It Fl L Ar label 235The user-supplied text string 236.Ar label 237is placed into the dump header, where tools like 238.Xr restore 8 239and 240.Xr file 1 241can access it. 242Note that this label is limited 243to be at most LBLSIZE (currently 16) characters, which must include 244the terminating 245.Ql \e0 . 246.It Fl n 247Whenever 248.Nm 249requires operator attention, 250notify all operators in the group 251.Qq operator 252by means similar to a 253.Xr wall 1 . 254.It Fl r Ar cachesize 255Use that many buffers for read cache operations. 256A value of zero disables the read cache altogether, higher values 257improve read performance by reading larger data blocks from the 258disk and maintaining them in an LRU cache. See the 259.Fl k 260option for the size of the buffers. Maximum is 512, the size of the cache is 261limited to 15% of the avail RAM by default. 262.It Fl s Ar feet 263Attempt to calculate the amount of tape needed 264at a particular density. 265If this amount is exceeded, 266.Nm 267prompts for a new tape. 268It is recommended to be a bit conservative on this option. 269The default tape length is 2300 feet. 270.It Fl S 271Display an estimate of the backup size and the number of tapes 272required, and exit without actually performing the dump. 273.It Fl t 274All informational log messages printed by 275.Nm 276will have the time prepended to them. Also, the completion time 277interval estimations will have the estimated time at which the dump 278will complete printed at the end of the line. 279.It Fl T Ar date 280Use the specified date as the starting time for the dump 281instead of the time determined from looking in 282.Pa /etc/dumpdates . 283The format of date is the same as that of 284.Xr ctime 3 . 285This option is useful for automated dump scripts that wish to 286dump over a specific period of time. 287The 288.Fl T 289option is mutually exclusive from the 290.Fl u 291option. 292.It Fl u 293Update the file 294.Pa /etc/dumpdates 295after a successful dump. 296The format of 297.Pa /etc/dumpdates 298is readable by people, consisting of one 299free format record per line: 300file system name, 301increment level 302and 303.Xr ctime 3 304format dump date. 305There may be only one entry per file system at each level. 306The file 307.Pa /etc/dumpdates 308may be edited to change any of the fields, 309if necessary. 310If a list of files or subdirectories is being dumped 311(as opposed to an entire file system), then 312.Fl u 313is ignored. 314.It Fl W 315.Nm 316tells the operator what file systems need to be dumped. 317This information is gleaned from the files 318.Pa /etc/dumpdates 319and 320.Pa /etc/fstab . 321The 322.Fl W 323option causes 324.Nm 325to print out, for each file system in 326.Pa /etc/dumpdates 327the most recent dump date and level, 328and highlights those file systems that should be dumped. 329If the 330.Fl W 331option is set, all other options are ignored, and 332.Nm 333exits immediately. 334.It Fl w 335Is like W, but prints only those file systems which need to be dumped. 336.El 337.Pp 338If 339.Nm 340honors the 341.Qq nodump 342flag 343.Pq Dv UF_NODUMP , 344files with the 345.Qq nodump 346flag will not be backed up. If a directory has the 347.Qq nodump 348flag, this directory and any file or directory under it will not be backed up. 349.Pp 350.Nm 351requires operator intervention on these conditions: 352end of tape, 353end of dump, 354tape write error, 355tape open error or 356disk read error (if there are more than a threshold of 32). 357In addition to alerting all operators implied by the 358.Fl n 359option, 360.Nm 361interacts with the operator on 362.Nm "" Ns 's 363control terminal at times when 364.Nm 365can no longer proceed, 366or if something is grossly wrong. 367All questions 368.Nm 369poses 370.Em must 371be answered by typing 372.Qq yes 373or 374.Qq no , 375appropriately. 376.Pp 377Since making a dump involves a lot of time and effort for full dumps, 378.Nm 379checkpoints itself at the start of each tape volume. 380If writing that volume fails for some reason, 381.Nm 382will, 383with operator permission, 384restart itself from the checkpoint 385after the old tape has been rewound and removed, 386and a new tape has been mounted. 387.Pp 388.Nm 389tells the operator what is going on at periodic intervals, 390including usually low estimates of the number of blocks to write, 391the number of tapes it will take, the time to completion, and 392the time to the tape change. 393The output is verbose, 394so that others know that the terminal 395controlling 396.Nm 397is busy, 398and will be for some time. 399.Pp 400In the event of a catastrophic disk event, the time required 401to restore all the necessary backup tapes or files to disk 402can be kept to a minimum by staggering the incremental dumps. 403An efficient method of staggering incremental dumps 404to minimize the number of tapes follows: 405.Bl -bullet -offset indent 406.It 407Always start with a level 0 backup, for example: 408.Bd -literal -offset indent 409/sbin/dump -0u -f /dev/nrst1 /usr/src 410.Ed 411.Pp 412This should be done at set intervals, say once a month or once every two months, 413and on a set of fresh tapes that is saved forever. 414.It 415After a level 0, dumps of active file 416systems are taken on a daily basis, 417using a modified Tower of Hanoi algorithm, 418with this sequence of dump levels: 419.Bd -literal -offset indent 4203 2 5 4 7 6 9 8 9 9 ... 421.Ed 422.Pp 423For the daily dumps, it should be possible to use a fixed number of tapes 424for each day, used on a weekly basis. 425Each week, a level 1 dump is taken, and 426the daily Hanoi sequence repeats beginning with 3. 427For weekly dumps, another fixed set of tapes per dumped file system is 428used, also on a cyclical basis. 429.El 430.Pp 431After several months or so, the daily and weekly tapes should get 432rotated out of the dump cycle and fresh tapes brought in. 433.Pp 434If 435.Nm 436receives a 437.Dv SIGINFO 438signal 439(see the 440.Qq status 441argument of 442.Xr stty 1 ) 443whilst a backup is in progress, statistics on the amount completed, 444current transfer rate, and estimated finished time, will be written 445to the standard error output. 446.Sh ENVIRONMENT 447If the following environment variables exist, they are utilized by 448.Nm "" . 449.Bl -tag -width Fl 450.It Ev TAPE 451If no -f option was specified, 452.Nm 453will use the device specified via 454.Ev TAPE 455as the dump device. 456.Ev TAPE 457may be of the form 458.Qq tapename , 459.Qq host:tapename , 460or 461.Qq user@host:tapename . 462.It Ev RCMD_CMD 463.Nm 464will use 465.Ev RCMD_CMD 466rather than 467.Xr rsh 1 468to invoke 469.Xr rmt 8 470on the remote machine. 471.It Ev TIMEFORMAT 472can be used to control the format of the timestamps produced by the 473.Fl t 474option. 475.Ev TIMEFORMAT 476is a string containing embedded formatting commands for 477.Xr strftime 3 . 478The total formatted string is limited to about 80 characters, if this 479limit is exceeded then 480.Qo 481ERROR: TIMEFORMAT too long, reverting to default 482.Qc 483will be printed and the time format will revert to the default one. If 484.Ev TIMEFORMAT 485is not set then the format string defaults to 486.Qo 487%T %Z 488.Qc 489.El 490.Sh FILES 491.Bl -tag -width /etc/dumpdates -compact 492.It Pa /dev/nrst0 493default tape unit to use. Taken from 494.Dv _PATH_DEFTAPE 495in 496.Pa /usr/include/paths.h . 497.It Pa /dev/rst* 498raw SCSI tape interface 499.It Pa /etc/dumpdates 500dump date records 501.It Pa /etc/fstab 502dump table: file systems and frequency 503.It Pa /etc/group 504to find group 505.Em operator 506.El 507.Sh DIAGNOSTICS 508Many, and verbose. 509.Pp 510.Nm 511exits with zero status on success. 512Startup errors are indicated with an exit code of 1; 513abnormal termination is indicated with an exit code of 3. 514.Sh SEE ALSO 515.Xr chflags 1 , 516.Xr stty 1 , 517.Xr fts 3 , 518.Xr st 4 , 519.Xr fstab 5 , 520.Xr environ 7 , 521.Xr restore 8 , 522.Xr rmt 8 523.Sh HISTORY 524A 525.Nm 526command appeared in 527.At v6 . 528.Sh BUGS 529Fewer than 32 read errors on the file system are ignored. 530.Pp 531Each reel requires a new process, so parent processes for 532reels already written just hang around until the entire tape 533is written. 534.Pp 535.Nm 536with the 537.Fl W 538or 539.Fl w 540options does not report file systems that have never been recorded 541in 542.Pa /etc/dumpdates , 543even if listed in 544.Pa /etc/fstab . 545.Pp 546When dumping a list of files or subdirectories, access privileges are 547required to scan the directory (as this is done via the 548.Xr fts 3 549routines rather than directly accessing the file system). 550.Pp 551It would be nice if 552.Nm 553knew about the dump sequence, 554kept track of the tapes scribbled on, 555told the operator which tape to mount when, 556and provided more assistance 557for the operator running 558.Xr restore 8 . 559