1. 运行ioscan -funC tape 检查是否有可用的磁带设备,如下:
NAME
fbackup - selectively back up files
SYNOPSIS
/etc/fbackup -f device [-f device] ... [-0-9] [-uvyAH] [-i path] [-e
path] [-g graph] [-I path] [-V path] [-c config]
/etc/fbackup -f device [-f device] ... [-R restart] [-uvyAH] [-I path]
[-V path] [-c config]
DESCRIPTION
fbackup combines features of dump and ftio to provide a flexible,
high-speed file system backup mechanism (see and ).
fbackup selectively transfers files to an output device. For each
file transferred, the file's contents and all the relevant information
necessary to restore it to an equivalent state are copied to the
output device. The output device can be a raw magnetic tape drive,
the standard output, a DDS-format tape, a rewritable magneto-optical
disk or a file.
The selection of files to backup is done by explicitly specifying
trees of files to be included or excluded from an fbackup session.
The user can construct an arbitrary graph of files by using the -i or
-e options on the command line, or by using the -g option with a graph
file. For backups being done on a regular basis, the -g option
provides an easier interface for controlling the backup graph.
fbackup selects files in this graph, and attempts to transfer them to
the output device. The selectivity depends on the mode in which
fbackup is being used; i.e., full or incremental backup.
When doing full backups, all files in the graph are selected. When
doing incremental backups, only files in the graph that have been
modified since a previous backup of that graph are selected. If an
incremental backup is being done at level 4 and the -g option is used,
the database file is searched for the most recent previous backup at
levels 0-3. If a file's modification time is before the time when the
last appropriate session began and the i-node change time is before
the time that same session ended, the file is not backed up.
Beginning at HP-UX Release 8.0, all directories lying on the path to a
file that qualifies for the incremental backup will also be on the
backup media, even if the directories do not qualify on their own
status.
If fbackup is used for incremental backups, a database of past backups
must be kept. fbackup maintains this data in the text file
/usr/adm/fbackupfiles/dates, by default. Note that the directory
/usr/adm/fbackupfiles must be created prior to the first time fbackup
is used for incremental backups. The -d option can be used to specify
an alternate database file. The user can specify to update this file
when an fbackup session completes successfully. Entries for each
session are recorded on separate pairs of lines. The following four
items appear on the first line of each pair: the graph file name,
backup level, starting time, and ending time (both in format).
The second line of each pair contains the same two times, but in
format. These lines contain the local equivalent of
STARTED:, the start time, the local equivalent of ENDED:, and the
ending time. These second lines serve only to make the dates file
more readable; fbackup does not use them. All fields are separated by
white space. Graph file names are compared character-by-character
when checking the previous-backup database file to ascertain when a
previous session was run for that graph. Caution must be exercised to
ensure that, for example, graph and ./graph are not used to specify
the same graph file because fbackup treats them as two different graph
files.
The general structure of a fbackup volume is the same, no matter what
type of device is used. There are some small specific differences due
to differing capabilities of devices. The general structure is as
follows:
o Reserved space for ASCII tape label (1024 bytes)
o fbackup specific volume label (2048 bytes)
o session index (size in field of volume label)
o data
Each file entry in the index contains the volume number and the
pathname of the file. At the beginning of every volume, fbackup
assumes that all files not already backed up will fit on that volume;
an erroneous assumption for all but the last volume. Indices are
accurate only for the previous volumes in the same set. Hence, the
index on the last volume may indicate that a file resides on that
volume, but it may not have actually been backed up (for example, if
it was removed after the index was created, but before fbackup
attempted to back it up). The only index guaranteed to be correct in
all cases is the on-line index (-I option), which is produced after
the last volume has been written. Specific minor differences are
listed below:
o When using 9-track tape drives or DDS-format tape drives
several small differences exist. The main blocks of
information are separated by EOFs. fbackup checkpoints the
media periodically to enhance error recovery. If a write
error is detected, the user normally has two options: First, a
new volume can be mounted and that volume rewritten from the
beginning. Second, if the volume is not too severely damaged,
the good data before the error can be saved, and the write
error is treated as a normal end-of-media condition. The
blocks of data with their checkpoint records are also
separated by EOFs. In addition if the DDS-format drive
supports Fast Search Marks these will be used to enhance
recovery speed by placing them between blocks of files.
o For a magneto-optical device, a disk, a file, or standard
output, there are no special marks separating the information
pieces. Using standard output results in only one volume.
fbackup provides the ability to use UCB-mode tape drives. This makes
it possible to overlap the tape rewind times if two or more tape
drives are connected to the system.
Set-up
There are several things the user will want to consider when setting
fbackup up for regular use. These include type of device and media,
full versus incremental frequency, amount of logging information to
keep on-line, structure of the graph file, and on-line versus off-line
backup.
The type of device used for backups can affect such things as media
expenses, ability to do unattended backup and speed of the backup.
Using 9-track tapes will probably result in the highest performance,
but require user intervention for changing tapes. A magneto-optical
autochanger can provide an unattended backup for a large system and
long life media, however the media cost is high. The lowest cost will
probably be achieved through DDS-format devices, but at the lowest
performance.
It is also important to consider how often full backups should be
made, and how many incremental backups to make between full backups.
Time periods can be used, such as a full backup every Friday and
incrementals on all other days. Media capacities can be used if
incremental backups need to run unattended. The availability of
personnel to change media can also be an important factor as well as
the length of time needed for the backup. Other factors may affect
the need for full and incremental backup combinations such as
contractual or legal requirements.
If backup information is kept online; i.e., output from the -V or -I
options, the required storage space must also be considered. Index
file sizes are hard to predict in advance because they depend on
system configuration. Each volume header file takes less than 1536
bytes. Of course the more information that is kept on-line, the
faster locating a backup media for a recovery will be. Another point
to consider is that the default directory for the database file is
/usr/adm and this is a context-dependent file on clustered systems,
meaning that files may or may not be visible, depending on system
context.
There are several ways to structure the graph file or files used in a
system backup. The first decision involves whether to use one or more
than one graph files for the backup. Using one file is simpler, but
less flexible. Using two or more graph files simplifies splitting
backups into logical sets. For example, one graph file can be used
for system disks where changes tend to be less frequent, and another
graph file for the users area. Thus two different policies can be
implemented for full and incremental backups.
fbackup was designed to allow backups while the system is in use by
providing the capability to retry an active file. When absolute
consistency on a full backup is important, the system should probably
be in single-user mode. However, incremental backups can be made
while the system is in normal use, thus improving system up-time.
Options
-c config config is the name of the configuration file, and can
contain values for the following parameters:
o Number of 1024-byte blocks per record,
o Number of records of shared memory to allocate,
o Number of records between checkpoints,
o Number of file-reader processes,
o Maximum number of times fbackup is to retry an
active file,
o Maximum number of bytes of media to use while
retrying the backup of an active file,
o Maximum number of times a magnetic tape volume
can be used,
o Name of a file to be executed when a volume
change occurs. This file must exist and be
executable.
o Name of a file to be executed when a fatal error
occurs. This file must exist and be executable.
o The number of files between the Fast Search Marks
on DDS-format tapes. The cost of these marks are
negligible in terms of space on the DDS-format
tape. Not all DDS-format devices support fast
search marks.
Each entry in the configuration file consists of one
line of text in the following format: identifier, white
space, argument. In the following sample configuration
file, the number of blocks per record is set to 16, the
number of records is set to 32, the checkpoint
frequency is set to 32, the number of file reader
processes is set to 2, the maximum number of retries is
set to 5, the maximum retry space for active files is
set to 5,000,000 bytes, the maximum number of times a
magnetic tape volume can be used is set to 100, the
file to be executed at volume change time is
/usr/adm/fbackupfiles/chgvol, the file to be executed
when a fatal error occurs is
/usr/adm/fbackupfiles/error, and the number of files
between fast search marks is set to 200.
blocksperrecord 16
records 32
checkpointfreq 32
readerprocesses 2 (maximum of 6)
maxretries 5
retrylimit 5000000
maxvoluses 100
chgvol /usr/adm/fbackupfiles/chgvol
error /usr/adm/fbackupfiles/error
filesperfsm 200
Each value listed is also the default value, except
chgvol and error, which default to null values.
-d path This specifies a path to a database for use with
incremental backups. It overrides the default database
file /usr/adm/fbackupfiles/dates.
-e path path specifies a tree to be excluded from the backup
graph. This tree must be a subtree of part of the
backup graph. Otherwise, specifying it will not
exclude any files from the graph. There is no limit on
how many times the -e option can be specified.
-f device device specifies the name of an output file. If the
name of the file is -, fbackup writes to the standard
output. There is no default output file; at least one
must be specified. If more than one output file is
specified, fbackup uses each one successively and then
repeats in a cyclical pattern. Patterns can be used in
the device name in a manner resembling file name
expansion as done by the shell (see and
other shell manual entries. The patterns must be
protected from expansion by the shell by quoting them.
The expansion of the pattern results in all matching
names being in the list of devices used.
There is slightly different behavior if remote devices
are used. A device on the remote machine can be
specified in the form machine:device. fbackup creates
a server, /etc/rmt, on the remote machine to access the
tape device. The pattern matching capability does not
apply to remote devices. Only half-inch 9-track
magnetic tapes or DDS-format tapes can be remote
devices. The fast search capability is not used when
remote DDS-format devices are used.
-g graph graph defines the graph file. The graph file is a text
file containing the list of file names of trees to be
included or excluded from the backup graph. These
trees are interpreted in the same manner as when they
are specified with the -i and -e options. Graph file
entries consist of a line beginning with either i or e,
followed by white space, and then the path name of a
tree. Lines not beginning with i or e are treated as
an error. There is no default graph file. For
example, to backup all of /usr except for the subtree
/usr/lib, a file could be created with the following
two records:
i /usr
e /usr/lib
-i path path specifies a tree to be included in the backup
graph. There is no limit on how many times the -i
option can be specified.
-n Cross NFS mount points. By default fbackup does not
cross NFS mount points, regardless of paths specified
by the -i or -g options.
-s Backup the object that a symbolic link refers to. The
default behavior is to backup the symbolic link.
-u Update the database of past backups so that it contains
the backup level, the time of the beginning and end of
the session, and the graph file used for this fbackup
session. For this update to take place, the following
conditions must exist: Neither the -i nor the -e option
can be used; the -g option must be specified exactly
once (see below); the fbackup must complete
successfully.
-v Run in verbose mode. Generates status messages that
are otherwise not seen.
-y Automatically answer yes to any inquiries.
-A Do not back up optional entries of access control lists
(ACLs) for files. Normally, all mode information is
backed up including the optional ACL entries. With the
-A option, the summary mode information (as returned by
stat()) is backed up. Use this option when backing up
files from a system that contains ACLs to be recovered
on a system that does not understand ACLs (see ).
-H Search hidden subdirectories (context-dependent files
or CDFs). Normally, only the CDF element matching the
current context is backed up without expanding the path
name to show the actual element. For more information
on CDFs, see .
-I path path specifies the name of the on-line index file to be
generated. It consists of one line for each file
backed up during the session. Each line contains the
volume number on which that file resides and the file
name. If the -I option is omitted, no index file is
generated.
-V path The volume header information is written to path at the
end of a successful fbackup session. The following
fields from the header are written in the format
label:value with one pair per line.
Magic Field On a valid fbackup media it
contains the value FBACKUP
LABEL.
Machine Identification This field contains the
result of uname -m.
System Identification This field contains the
result of uname -s.
Release Identification This field contains the
result of uname -r.
Node Identification This field contains the
result of uname -n.
User Identification This field contains the
result of cuserid() (see
cuserid(3S)).
Record Size This field contains the
maximum length in bytes of
a data record.
Time This field contains the
clock time when fbackup was
started.
Media Use This field contains the
number of times the media
has been used for backup.
Since the information is
actually on the media, this
field will always contain
the value 0.
Volume Number This field contains a #
character followed by 3
digits, and identifies the
number of volumes in the
backup.
Checkpoint Frequency This field contains the
frequency of backup-data-
record checkpointing.
Index Size This field contains the
size of the index.
Backup Identification Tag
This field is composed of
two items: the process ID
(pid) and the start time of
that process.
Language This field contains the
language used to make the
backup.
-R restart Restart an fbackup session from where it was previously
interrupted. The restart file contains all the
information necessary to restart the interrupted
session. None of the -[ieg0-9] options can be used
together with the restart option.
-0-9 This single-digit number is the backup level. Level 0
indicates a full backup. Higher levels are generally
used to perform incremental backups. When doing an
incremental backup of a particular graph at a
particular level, the database of past backups is
searched to find the date of the most recent backup of
the same graph that was done at a lower level. If no
such entry is found, the beginning of time is assumed.
All files in the graph that have been modified since
this date are backed up.
Access Control Lists (ACLs)
If a file has optional ACL entries, the -A option is required to
enable its recovery on a system whose access control lists capability
is not present.
EXTERNAL INFLUENCES
Environment Variables
LC_COLLATE determines the order in which files are stored in the
backup device and the order output by the -I option.
LC_TIME determines the format and contents of date and time strings.
LANG determines the language in which messages are displayed.
If LC_COLLATE and LC_TIME are not both specified in the environment or
if either is set to the empty string, the value of LANG is used as a
default for each unspecified or empty variable. If LANG is not
specified or is set to the empty string, a default of "C" (see
) is used instead of LANG. If any internationalization
variable contains an invalid setting, fbackup behaves as if all
internationalization variables are set to "C". See .
International Code Set Support
Single- and multi-byte character code sets are supported.
RETURN VALUE
fbackup returns 0 upon normal completion, 1 if it is interrupted but
allowed to save its state for possible restart, and 2 if any error
conditions prevent the session from completing.
EXAMPLES
In the following two examples, assume the graph of interest specifies
all of /usr except /usr/lib (as described in the g key section above).
The first example is a simple case where a full backup is done but the
database file is not updated. This can be invoked as follows:
/etc/fbackup -0i /usr -e /usr/lib -f /dev/rmt/0h
The second example is more complicated, and assumes the user wants to
maintain a database of past fbackup sessions so that incremental
backups are possible.
If sufficient on-line storage is available, it may be desirable to
keep several of the most recent index files on disk. This eliminates
the need to recover the index from the backup media to determine if
the files to be recovered are on that set. One method of maintaining
on-line index files is outlined below. The system administrator must
do the following once before fbackup is run for the first time
(creating intermediate level directories where necessary):
o Create a suitable configuration file called config in the
directory /usr/adm/fbackupfiles
o Create a graph file called usr-usrlib in the directory
/usr/adm/fbackupfiles/graphs
o Create a directory called usr-usrlib in the directory
/usr/adm/fbackupfiles/indices
A shell script that performs the following tasks could be run for each
fbackup session:
o Build an index file path name based on both the graph file
used (passed as a parameter to the script) and the start time
of the session (obtained from the system). For example:
/usr/adm/fbackupfiles/indices/usr-usrlib/871128.15:17
(for Nov 28, 1987 at 3:17 PM)
o Invoke fbackup with this path name as its index file name.
For example:
cd /usr/adm/fbackupfiles
/etc/fbackup -0uc config -g graphs/usr-usrlib\
-I indices/usr-usrlib/871128.15:17\
-f /dev/rmt/0h
When the session completes successfully, the index is automatically
placed in the proper location.
Note that fbackup should be piped to tcio when backing up to a CS/80
cartridge tape device see ). The following example copies the
entire contents of directory /usr to a cartridge tape:
/etc/fbackup i /usr -f - | tcio -oe /dev/rct/c0d1s2
WARNINGS
Starting with HP-UX Release 8.0, fbackup does not back up network
special files because RFA networking is obsolete. A warning message
is issued if a network special file is encountered in the backup graph
and the file is skipped.
The use of fbackup for backing up NFS mounted file systems is not
guaranteed to work as expected if the backup is done as a privileged
user. This is due to the manner in which NFS handles privileged-user
access by mapping user root and uid 0 to user nobody, usually uid -2,
thus disallowing root privileges on the remote system to a root user
on the local system.
The utility set comprised of fbackup and frecover was originally
designed for use on systems equipped with not more than one gigabyte
of total file system storage. Although the utilities have no
programming limitations that restrict users to this size, complete
backups and recoveries of substantially larger systems can cause a
large amount system activity due to the amount of virtual memory (swap
space) used to store the indices. Users who want to use these
utilities, but are noticing poor system-wide performance due to the
size of the backup, are encouraged to backup their systems in multiple
smaller sessions, rather than attempting to backup the entire system
at one time.
Due to present file-system limitations, files whose inode data, but
not their contents, are modified while a backup is in progress might
be omitted from the next incremental backup of the same graph. Also,
fbackup does not reset the inode change times of files to their
original value.
fbackup allocates resources that are not returned to the system if it
is killed in an ungraceful manner. If it is necessary to kill
fbackup, send it a SIGTERM; not a SIGKILL.
For security reasons, configuration files and the chgvol and error
executable files should only be writable by their owners.
If sparse files are backed up without using data compression, a very
large amount of media can be consumed.
Hewlett-Packard Company - 10 - HP-UX Release 9.0: August 1992
fbackup does not require special privileges. However, if the user
does not have access to a given file, the file is not backed up.
fbackup consists of multiple executable objects, all of which are
expected to reside in directory /etc.
fbackup creates volumes with a format that makes duplication of
volumes by dd impossible (see ). Copying an fbackup volume
created on one media type to another media type does not produce a
valid fbackup volume on the new media because the formats of volumes
on 9-track tape, backup to a file, rewritable optical disks and DDS
-format tapes are not identical.
When configuring the parameter blocksperrecord (see -c option), the
record size is limited by the maximum allowed for the tape drive.
Common maximum record sizes include 16 1-Kbyte blocks for tape drive
models HP7974 and HP7978A, 32 blocks for the HP7978B, 60 blocks for
the HP7980, and 64 blocks for DDS tape drives. Note also that the
blocksize used in earlier releases (7.0 and before) was 512 bytes,
whereas it is now 1024 bytes. This means that the same value
specified in blocksperrecord in an earlier release creates blocks
twice their earlier size in the current release (i.e., a
blocksperrecord parameter of 32 would create 16-Kbyte blocks at
Release 7.0, but now creates 32-Kbyte blocks). If blocksperrecord
exceeds the byte count allowed by the tape drive, the tape drive
rejects the write, causing an error to be communicated to fbackup
which fbackup interprets as a bad tape. The resulting write error
message resembles the following:
fbackup (3013): Write error while writing backup at tape block 0.
Diagnostic error from tape 11...... SW_PROBLEM (printed by
driver on console)
fbackup (3102): Attempting to make this volume salvageable.
etc.
DEPENDENCIES
NFS
Access control lists of networked files are summarized (as returned in
st_mode by stat()), but not copied to the new file (see ).
Series 800
On NIO-bus machines there can be problems when a CS/80 cartridge tape
device is on the same interface card as hard disk devices. If writes
longer than 16K bytes are made to the tape device, it is possible to
have disk access time-out errors. This happens because the tape
device has exclusive access to the bus during write operations.
Depending on the system activity, this problem may not be seen. The
default write size of fbackup is 16 Kbytes.
Series 700/800
fbackup does not support QIC-120, and QIC-150 formats on QIC devices.
Hewlett-Packard Company - 11 - HP-UX Release 9.0: August 1992
If fbackup is attempted for these formats, fbackup fails and the
following message is displayed :
mt lu X: Write must be a multiple of 512 bytes in QIC 120 or QIC
150
AUTHOR
fbackup was developed by HP.