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