DUMP_LFS(8)             NetBSD System Manager's Manual             DUMP_LFS(8)

NAME
     dump_lfs, rdump_lfs -- filesystem backup

SYNOPSIS
     dump_lfs [-0123456789aceFnStuX] [-B records] [-b blocksize] [-d density]
              [-f file] [-h level] [-k read-blocksize] [-L label] [-l timeout]
              [-r cachesize] [-s feet] [-T date] [-x snap-backup]
              files-to-dump
     dump_lfs [-W | -w]

              (The 4.3BSD option syntax is implemented for backward compati-
              bility, but is not documented here).

DESCRIPTION
     dump_lfs examines files on a file system and determines which files need
     to be backed up.  These files are copied to the given disk, tape or other
     storage medium for safe keeping (see the -f option below for doing remote
     backups).  A dump that is larger than the output medium is broken into
     multiple volumes.  On most media the size is determined by writing until
     an end-of-media indication is returned.  This can be enforced by using
     the -a option.

     On media that cannot reliably return an end-of-media indication (such as
     some cartridge tape drives) each volume is of a fixed size; the actual
     size is determined by the tape size and density and/or block count
     options below.  By default, the same output file name is used for each
     volume after prompting the operator to change media.

     files-to-dump is either a single file system, or a list of files and
     directories on a single file system to be backed up as a subset of the
     file system.  In the former case, files-to-dump may be the device of a
     file system, the path to a currently mounted file system, the path to an
     unmounted file system listed in /etc/fstab, or, if -F is given, a file
     system image.  In the latter case, certain restrictions are placed on the
     backup: -u is ignored, the only dump level that is supported is -0, and
     all of the files must reside on the same file system.

     The following options are supported by dump_lfs:

     -0-9    Dump levels.  A level 0, full backup, guarantees the entire file
             system is copied (but see also the -h option below).  A level
             number above 0, incremental backup, tells dump to copy all files
             new or modified since the last dump of a lower level.  The
             default level is 9.

     -a      ``auto-size''.  Bypass all tape length considerations, and
             enforce writing until an end-of-media indication is returned.
             This fits best for most modern tape drives.  Use of this option
             is particularly recommended when appending to an existing tape,
             or using a tape drive with hardware compression (where you can
             never be sure about the compression ratio).

     -B records
             The number of kilobytes per volume, rounded down to a multiple of
             the blocksize.  This option overrides the calculation of tape
             size based on length and density.

     -b blocksize
             The number of kilobytes per dump record.

     -c      Modify the calculation of the default density and tape size to be
             more appropriate for cartridge tapes.

     -d density
             Set tape density to density.  The default is 1600 Bits Per Inch
             (BPI).

     -e      Eject tape automatically if a tape change is required.

     -F      Indicates that files-to-dump is a file system image.

     -f file
             Write the backup to file; file may be a special device file like
             /dev/rst0 (a tape drive), /dev/rsd1c (a disk drive), an ordinary
             file, or `-' (the standard output).  Multiple file names may be
             given as a single argument separated by commas.  Each file will
             be used for one dump volume in the order listed; if the dump
             requires more volumes than the number of names given, the last
             file name will used for all remaining volumes after prompting for
             media changes.  If the name of the file is of the form
             "host:file", or "user@host:file", dump_lfs writes to the named
             file on the remote host using rmt(8).  Note that methods more
             secure than rsh(1) (such as ssh(1)) can be used to invoke rmt(8)
             on the remote host, via the environment variable RCMD_CMD.  See
             rcmd(3) for more details.

     -h level
             Honor the user "nodump" flag (UF_NODUMP) only for dumps at or
             above the given level.  The default honor level is 1, so that
             incremental backups omit such files but full backups retain them.

     -k read-blocksize
             The size in kilobyte of the read buffers, rounded up to a multi-
             ple of the file system block size.  Default is 32k.

     -l timeout
             If a tape change is required, eject the tape and wait for the
             drive to be ready again.  This is to be used with tape changers
             which automatically load the next tape when the tape is ejected.
             If after the timeout (in seconds) the drive is not ready dump_lfs
             falls back to the default behavior, and prompts the operator for
             the next tape.

     -L label
             The user-supplied text string label is placed into the dump
             header, where tools like restore(8) and file(1) can access it.
             Note that this label is limited to be at most LBLSIZE (currently
             16) characters, which must include the terminating `\0'.

     -n      Whenever dump_lfs requires operator attention, notify all opera-
             tors in the group "operator" using wall(1).

     -r cachesize
             Use that many buffers for read cache operations.  A value of zero
             disables the read cache altogether, higher values improve read
             performance by reading larger data blocks from the disk and main-
             taining them in an LRU cache.  See the -k option for the size of
             the buffers.  Maximum is 512, the size of the cache is limited to
             15% of the avail RAM by default.

     -s feet
             Attempt to calculate the amount of tape needed at a particular
             density.  If this amount is exceeded, dump_lfs prompts for a new
             tape.  It is recommended to be a bit conservative on this option.
             The default tape length is 2300 feet.

     -S      Display an estimate of the backup size and the number of tapes
             required, and exit without actually performing the dump.

     -t      All informational log messages printed by dump_lfs will have the
             time prepended to them.  Also, the completion time interval esti-
             mations will have the estimated time at which the dump will com-
             plete printed at the end of the line.

     -T date
             Use the specified date as the starting time for the dump instead
             of the time determined from looking in /etc/dumpdates.  The for-
             mat of date is the same as that of ctime(3).  This option is use-
             ful for automated dump scripts that wish to dump over a specific
             period of time.  The -T option is mutually exclusive from the -u
             option.

     -u      Update the file /etc/dumpdates after a successful dump.  The for-
             mat of /etc/dumpdates is readable by people, consisting of one
             free format record per line: file system name, increment level
             and ctime(3) format dump date.  There may be only one entry per
             file system at each level.  The file /etc/dumpdates may be edited
             to change any of the fields, if necessary.  If a list of files or
             subdirectories is being dumped (as opposed to an entire file sys-
             tem), then -u is ignored.

     -X      Prevent the log from wrapping until the dump completes, guaran-
             teeing a consistent backup.  Processes that write to the filesys-
             tem will continue as usual until the entire log is full, after
             which they will block until the dump is complete.  This function-
             ality is analogous to what fss(4) provides for other file sys-
             tems.  The -x flag is provided for compatibility with dump(8); it
             functions exactly as the -X flag does (its argument is ignored).

     -W      dump_lfs tells the operator what file systems need to be dumped.
             This information is gleaned from the files /etc/dumpdates and
             /etc/fstab.  The -W option causes dump_lfs to print out, for each
             file system in /etc/dumpdates the most recent dump date and
             level, and highlights those file systems that should be dumped.
             If the -W option is set, all other options are ignored, and
             dump_lfs exits immediately.

     -w      Is like W, but prints only those file systems which need to be
             dumped.

     If dump_lfs honors the "nodump" flag (UF_NODUMP), files with the "nodump"
     flag will not be backed up.  If a directory has the "nodump" flag, this
     directory and any file or directory under it will not be backed up.

     dump_lfs requires operator intervention on these conditions: end of tape,
     end of dump, tape write error, tape open error or disk read error (if
     there are more than a threshold of 32).  In addition to alerting all
     operators implied by the -n option, dump_lfs interacts with the operator
     on dump_lfs's control terminal at times when dump_lfs can no longer pro-
     ceed, or if something is grossly wrong.  All questions dump_lfs poses
     must be answered by typing "yes" or "no", appropriately.

     Since making a dump involves a lot of time and effort for full dumps,
     dump_lfs checkpoints itself at the start of each tape volume.  If writing
     that volume fails for some reason, dump_lfs will, with operator permis-
     sion, restart itself from the checkpoint after the old tape has been
     rewound and removed, and a new tape has been mounted.

     dump_lfs tells the operator what is going on at periodic intervals,
     including usually low estimates of the number of blocks to write, the
     number of tapes it will take, the time to completion, and the time to the
     tape change.  The output is verbose, so that others know that the termi-
     nal controlling dump_lfs is busy, and will be for some time.

     In the event of a catastrophic disk event, the time required to restore
     all the necessary backup tapes or files to disk can be kept to a minimum
     by staggering the incremental dumps.  An efficient method of staggering
     incremental dumps to minimize the number of tapes follows:

           o   Always start with a level 0 backup, for example:

                     /sbin/dump -0u -f /dev/nrst1 /usr/src

               This should be done at set intervals, say once a month or once
               every two months, and on a set of fresh tapes that is saved
               forever.

           o   After a level 0, dumps of active file systems are taken on a
               daily basis, using a modified Tower of Hanoi algorithm, with
               this sequence of dump levels:

                     3 2 5 4 7 6 9 8 9 9 ...

               For the daily dumps, it should be possible to use a fixed num-
               ber of tapes for each day, used on a weekly basis.  Each week,
               a level 1 dump is taken, and the daily Hanoi sequence repeats
               beginning with 3.  For weekly dumps, another fixed set of tapes
               per dumped file system is used, also on a cyclical basis.

     After several months or so, the daily and weekly tapes should get rotated
     out of the dump cycle and fresh tapes brought in.

     If dump_lfs receives a SIGINFO signal (see the "status" argument of
     stty(1)) whilst a backup is in progress, statistics on the amount com-
     pleted, current transfer rate, and estimated finished time, will be writ-
     ten to the standard error output.

ENVIRONMENT
     If the following environment variables exist, they are used by dump_lfs.

     TAPE        If no -f option was specified, dump_lfs will use the device
                 specified via TAPE as the dump device.  TAPE may be of the
                 form "tapename", "host:tapename", or "user@host:tapename".

     RCMD_CMD    dump_lfs will use RCMD_CMD rather than rsh(1) to invoke
                 rmt(8) on the remote machine.

     TIMEFORMAT  can be used to control the format of the timestamps produced
                 by the -t option.  TIMEFORMAT is a string containing embedded
                 formatting commands for strftime(3).  The total formatted
                 string is limited to about 80 characters, if this limit is
                 exceeded then "ERROR: TIMEFORMAT too long, reverting to
                 default" will be printed and the time format will revert to
                 the default one.  If TIMEFORMAT is not set then the format
                 string defaults to "%T %Z"

FILES
     /dev/nrst0      default tape unit to use.  Taken from _PATH_DEFTAPE in
                     /usr/include/paths.h.
     /dev/rst*       raw SCSI tape interface
     /etc/dumpdates  dump date records
     /etc/fstab      dump table: file systems and frequency
     /etc/group      to find group operator

DIAGNOSTICS
     Many, and verbose.

     dump_lfs exits with zero status on success.  Startup errors are indicated
     with an exit code of 1; abnormal termination is indicated with an exit
     code of 3.

SEE ALSO
     chflags(1), rcmd(1), stty(1), wall(1), fts(3), rcmd(3), st(4), fstab(5),
     environ(7), restore(8), rmt(8)

HISTORY
     A dump_lfs command appeared in NetBSD 1.5.

BUGS
     Fewer than 32 read errors on the file system are ignored.

     Each reel requires a new process, so parent processes for reels already
     written just hang around until the entire tape is written.

     dump_lfs with the -W or -w options does not report file systems that have
     never been recorded in /etc/dumpdates, even if listed in /etc/fstab.

     When dumping a list of files or subdirectories, access privileges are
     required to scan the directory (as this is done via the fts(3) routines
     rather than directly accessing the file system).

     It would be nice if dump_lfs knew about the dump sequence, kept track of
     the tapes scribbled on, told the operator which tape to mount when, and
     provided more assistance for the operator running restore(8).

NetBSD 5.0_STABLE                July 23, 2006               NetBSD 5.0_STABLE
