fbackup(1M)
NAME
fbackup − selectively back up files
SYNOPSIS
/usr/sbin/fbackup -f device [-f device] ... [-0-9] [-nsuvyAEl] [-i path] [-e path] [-g graph] [-d path] [-I path] [-V path] [-c config]
/usr/sbin/fbackup -f device [-f device] ... [-R restart] [-nsuvyAEl] [-d path] [-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 dump(1M) and ftio(1)). 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 /var/adm/fbackupfiles/dates, by default. Note that the directory /var/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 time(2) format). The second line of each pair contains the same two times, but in strftime(3C) 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:
• Reserved space for ASCII tape label (1024 bytes)
• fbackup specific volume label (2048 bytes)
• session index (size in field of volume label)
• 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:
• When using 9-track tape drives or DDS-format tape drives several small differences exist. The main blocks of information are separated by EOF. 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 EOF. 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.
• 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.
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:
• Number of 1024-byte blocks per record,
• Number of records of shared memory to allocate,
• Number of records between checkpoints,
• Number of file-reader processes,
• Maximum number of times fbackup is to retry an active file,
• Maximum number of bytes of media to use while retrying the backup of an active file,
• Maximum number of times a magnetic tape volume can be used,
• Name of a file to be executed when a volume change occurs. This file must exist and be executable.
• Name of a file to be executed when a fatal error occurs. This file must exist and be executable.
• 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 /var/adm/fbackupfiles/chgvol, the file to be executed when a fatal error occurs is /var/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 /var/adm/fbackupfiles/chgvol
error /var/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 /var/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 sh-bourne(1) 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 process from /usr/sbin/rmt on the remote machine to access the tape device. If /usr/sbin/rmt does not exist on the remote system, fbackup creates a server process from /etc/rmt on the remote machine to access the tape device. Only half-inch 9-track magnetic tapes or DDS-format tapes can be remote devices. The fast search and save set marks capabilities are 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.
-l Includes LOFS files specified by the backup graph. By default, fbackup does not cross LOFS mount points. If -l is specified, and the backup graph includes files which are also in a LOFS that is in the backup graph, then those files will backed up twice.
-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 ACL to be recovered on a system that does not understand ACL (see acl(5)).
-E Do not back up extent attributes. Normally, all extent attributes that have been set are included with the file. This option only applies to file systems which support extent attributes.
-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 (HP-UX release 10.20 and beyond). Before HP-UX release 10.20, it contained 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.
LC_MESSAGES determines the language in which messages are displayed.
If LC_COLLATE and LC_TIME and LC_MESSAGES are not all 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 lang(5)) 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 environ(5).
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:
/usr/sbin/fbackup -0i /usr -e /usr/lib -f /dev/rmt/c0t0d0BEST
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):
• Create a suitable configuration file called config in the directory /var/adm/fbackupfiles
• Create a graph file called usr-usrlib in the directory /var/adm/fbackupfiles/graphs
• Create a directory called usr-usrlib in the directory /var/adm/fbackupfiles/indices
A shell script that performs the following tasks could be run for each fbackup session:
• 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:
/var/adm/fbackupfiles/indices/usr-usrlib/871128.15:17
(for Nov 28, 1987 at 3:17 PM)
• Invoke fbackup with this path name as its index file name. For example:
cd /var/adm/fbackupfiles
/usr/sbin/fbackup -0uc config -g graphs/usr-usrlib\
-I indices/usr-usrlib/871128.15:17\
-f /dev/rmt/c0t0d0BEST
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 tcio(1)). The following example copies the entire contents of directory /usr to a cartridge tape:
/usr/sbin/fbackup i /usr -f - | tcio -oe /dev/rct/c0d1s2
WARNINGS
With release 10.20, HP-UX supports large files (greater than 2GB) and increased UID/GIDs (greater than 60,000). Archives containing files with these attributes would cause severe problems on systems that do not support the increased sizes. For this reason, fbackup creates tapes with a new magic number ("FBACKUP_LABEL"). This prevents fbackup tape archives from being restored on pre-10.20 HP-UX systems. frecover still reads both tape formats so that fbackup tape archives created on pre-10.20 HP-UX systems can be restored.
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.
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 /usr/sbin.
fbackup creates volumes with a format that makes duplication of volumes by dd impossible (see dd(1)). 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 stat(2)).
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. 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.
FILES
/var/adm/fbackupfiles/dates database of past backups
SEE ALSO
cpio(1), ftio(1), tcio(1), dump(1M), frecover(1M), ftio(1M), restore(1M), rmt(1M), stat(2), acl(5), mt(7).
Hewlett-Packard Company — HP-UX Release 10.20: July 1996