backup
PURPOSE
Backs up files.
SYNOPSIS
backup [ flag[option] ] [ [- level] [ -u ] [ filelsystem ] ]
[ -i ] [ -m [ filelsystem ] ]
DESCRIPTION
The backup command copies files in backup format to a
backup medium, such as a magnetic tape or diskette.
There are three ways to backup data:
o To backup specified files (backup by name) -i
o To backup an entire file system (backup by file
system or i-node) -level
o To backup an entire minidisk (backup by minidisk) -m
To backup by name, use the -i flag. The backup command
reads standard input for the names of the files to be
backed up. You can specify files by using the find
command to generate a list of path names and pipe the
list into the backup command.
Backing up by name allows you to backup files to a backup
medium on the local system or on a remote system. When
you specify -Q, -Q and -N, or when you use the print
-backup command, the system writes a backup header to the
backup medium. A header can contain the name of a quali-
fying directory and a target directory that subsequent
restore commands can use to restore the files to the
proper place. When a backup header is written if -Q is
not specified, the system writes the path of the backup
process's current directory to the header; if -N is not
specified, the system writes the id of the node that
requested the backup to the header.
To backup by file system (i-node), specify -level and
filesystem to indicate the files you want to back up.
You can use the level to back up either all files on the
system (a full backup) or only the files that have been
modified since a specific full backup (an incremental
backup). The possible levels are 0-9. If you do not
supply a level, the default level is 9. A level 0 backup
includes all files on the file system. A level n backup
includes all files modified since the last level n-1
backup. The levels, in conjunction with the -u flag,
provide an easy way to maintain a hierarchy of incre-
mental backups for each file system. For a discussion of
backup strategy and the use of incremental backups, see
Managing the AIX Operating System.
If you specify the name of a filesystem, it can be either
the physical device name (the block or raw name) or the
name of the directory on which the file system is
normally mounted. When you specify a directory, backup
reads /etc/filesystems for the physical device name. In
this case, it also acquires values for other backup
parameters from /etc/filesystems. If you do not specify
a file system, the default is the root file system on the
current minidisk.
To backup by minidisk, use the -m flag. This option
copies an exact image of the entire minidisk. You can
specify the file system name of the minidisk. The
default is the root directory of the current minidisk.
Because a backup by minidisk backs up an entire minidisk
as an exact image, a large minidisk with a small or
sparsely used file system may take longer and require
more backup medium to back up this way, rather than by
file system or by name.
When you do not specify a backup device, the backup
command writes files to a default backup device. For
backup by name, backup -i, the system writes to /dev/rfd0
unless you specify a device with the -f flag. For a
backup by file system, backup -level, or a backup by
minidisk, backup -m, if /etc/filesystems contains a
stanza that matches the name you specified and a stanza
with a backupdev entry, then the system writes to the
device specified by backupdev. Otherwise, the system
writes to /dev/rfd0 or the device specified with the -f
flag.
The backup command recognizes a special syntax for the
names of output files. If the argument is a range of
names, such as /dev/rfd0-3, the backup command automat-
ically goes from one drive in the range to the next.
After exhausting all of the specified drives, it halts
and requests that new volumes be mounted.
Notes:
1. If you backup by either file system or minidisk, the
backup source and target must be on the local system.
To backup to a remote system, backup by name with the
-i flag. This flag allows users in a distributed
services environment to backup files on a remote tape
drive.
2. You can also use the print -backup command to enqueue
your backup requests.
3. If the file system you are backing up is mounted and
is not the root file system, backup unmounts the file
system before it performs an i-node backup and then
remounts the file system before quitting. If the
file systems you are backing up include the root file
system, backup ensures that the other file systems
are not in use. If one is, it warns you of this use
and quits.
Warning: Be sure that the flags you specify match the
backup medium. If the backup medium is not a disk or
diskette, do not specify the -l flag. Similarly, if the
backup medium is not a tape, do not specify the -d or -s
flags. If you do specify flags that do not go with the
medium, backup displays an appropriate error message and
continues the backup.
FLAGS
-b Enables users to back up files in unattended
mode (user input is not permitted) to a backup
medium on a remote system. If any user input
(such as "Please insert volume 2") is
required, the command ends in an error. This
enables users to set up a shell file that
backs up files at night or at other times when
the user is unavailable.
-Cnum Specifies the number of blocks to write in a
single output operation. If you do not
specify num, backup uses a default value
appropriate for the physical device selected.
Larger values of num result in longer physical
transfers to tape devices. The value of the
-C flag is always ignored when backup writes
to diskette. In this case, it always writes
in clusters that occupy a complete track.
-ddensity Specifies the density of a tape medium in
bytes per inch. The default density is 700
bytes per inch.
-fdevice Specifies the output device. Specify device
as a file name (such as "/dev/rmt0") to send
output to the named device or specify -
(minus) to send output to the standard output
device. The - feature enables you to improve
performance when backing up to streaming tape
by piping the output of the backup command to
the dd command (see example).
-i Reads standard input for the names of files to
back up.
-lnum Uses num as the limit of the total number of
block to use on a diskette. The default value
is the entire diskette (2400 blocks).
-m Backs up the entire minidisk as an exact
image.
-N node Specifies the target node for subsequent
restore commands. The node can be a node
nickname or a node id (nicknames are trans-
lated to ids by backup). The backup command
writes the id of node in the backup header.
The default is the node id of the node where
the backup command is running.
-q Indicates that removable medium is ready to
use. When you specify this flag, backup pro-
ceeds without prompting you to prepare the
backup medium or waiting for you to press the
Enter key to continue. Same as -r flag.
-Q qdir Specifies the qualifying directory for subse-
quent restore commands. The backup command
stores this name in the backup header. Then a
subsequent restore command can use this infor-
mation to place files with path names that are
relative to a current directory in the quali-
fying directory. The qdir can be a relative
or absolute directory. The default is the
backup process's current working directory.
-r Indicates that removable medium is ready to
use. When you specify this flag, backup pro-
ceeds without prompting you to prepare the
backup medium or waiting for you to press the
Enter key to continue. Same as -q flag.
-slength Specifies the length in feet of usable space
on a tape medium. This is a combination of
the physical length and the number of tracks
on the tape. In the case of IBM RT PC
Streaming Tape, you should multiply the phys-
ical length of the tape by 9 (the number of
tracks) to determine the usable space avail-
able.
-u Updates the time, date, and level of the
backup in the /etc/budate file. This file
provides the information needed for incre-
mental backups.
-v Reports on each phase of the backup as it is
completed and gives regular progress reports
during the longest phase.
-level Specifies the backup level (0-9). The default
level is 9.
You should use the -u flag when you do an
incremental backup to ensure that information
regarding the last date, time, and level of
each incremental backup is written to the file
/etc/budate.
EXAMPLES
1. To back up selected files:
find $HOME -print | backup -i -v
The "-i" flag tells the system to read from standard
input the names of files to be backed up. The find
command generates a list of files in the user's
"$HOME" directory. This list is piped to the backup
command as standard input. The "-v" displays a
progress report as each file is copied. The files
are backed up on the default backup device for the
local system.
2. To back up an entire file system:
backup -0 -u /
The "-0" level and the "/" file system tell the
system to back up the entire root file system. The
file system is backed up to the default device
defined in the backupdev entry in /etc/filesystems if
it exits. Otherwise, the files are backed up to
/dev/rfd0/. The -u tells the system to update the
current backup level record in /etc/budate. Only the
root file system is backed up, not mounted file
systems.
3. To back up all files modified since the last level 0
backup:
backup -1 -u /
4. To back up an entire minidisk:
backup -mf/dev/rmt1 /xyz
This backs up the entire minidisk that contains the
file system "xyz". The "-f" tells the system to
backup the minidisk to the streaming tape on
"/dev/rmt1" instead of the default device.
5. To back up files by name to the remote default device
and specify the qualifying directory:
find filelist -print | backup -i -Q /tmp/darlene
The system backs up the files in "filelist" and
writes the qualifying directory "/tmp/darlene" to the
header. Since a target node is not specified, the
default node (the node where the backup command is
running) is written to the header.
6. To back up files to a remote device and specify both
the target node and the qualifying directory:
find . -print | backup -i -N darlene -Q /tmp/darlene
This command backs up the current directory (".").
The node nickname "darlene" is translated to a node
id and written to the header with the qualifying
directory "/tmp/darlene". Note that when "-N" is
specified, the "-Q" flag must also be present.
7. To improve performance on streaming tape, pipe the
backup command to the dd command:
backup -if- -C30 | dd of=/dev/rmt0 bs=30b
The backup command backs up by name ("i"), directs
the output to the standard output device ("f-"), and
specifies an output size as 30 blocks ("-C30b"). The
output is piped to dd. The dd command copies the
files to an output file which is a streaming tape
device ("of=/dev/rmt0") and specifies a file size of
30 blocks ("bs=30b"). The file size in both commands
should be the same. To restore these files, pipe the
dd command to restore.
FILES
/etc/filesystems Read for default parameters.
/etc/budate Log for most recent backup dates.
/dev/rfd0 Default backup device.
/dev/rhd0 Default file system.
RELATED INFORMATION
The following commands: "find," "format," "print,"
"restore," and "sh."
The backup and filesystems files and the tape special
file in AIX Operating System Technical Reference.
"Backing up Files and File Systems" in Managing the AIX
Operating System.