BACKUP(5,F) AIX Technical Reference BACKUP(5,F)
-------------------------------------------------------------------------------
backup
PURPOSE
Copies file system onto temporary storage media.
SYNOPSIS
#include <backup.h>
DESCRIPTION
A backup of the file system provides protection against substantial data loss
due to accidents or error. The backup command writes file system backups and,
conversely, the restore command reads file system backups. The following text
describes the format of a file system backup.
Header Types
The backup contains several different types of header records along with the
data in each file that is backed up. The types of header records are:
FS_VOLUME The volume label. This header exists on every volume.
FS_DFINDEX A version of FS_FINDEX for compatibility with AIX/RT; created using
the -c flag of the backup command.
FS_CLRI A bit map of inodes on the file system. A 0 bit indicates the inode
is not in use. This header exists only on the first volume. If the
backup is a level-zero backup, this header is omitted.
FS_BITS Another bit map of inodes. A one bit indicates the inode is present
on this volume or a subsequent volume. This header may not appear
on all volumes.
FS_VOLEND Indicates the end of the current volume. This header may not appear
on all volumes. This header is used to indicate that all index
entries on this volume are used.
FS_END Indicates the end of the backup. This header appears on every
volume.
FS_DINODE A version of FS_INODE for compatibility with AIX/RT; created using
the -c flag of the backup command.
FS_DNAME A version of FS_NAME for compatibility with AIX/RT; created using
the -c flag of the backup command.
Processed November 7, 1990 BACKUP(5,F) 1
BACKUP(5,F) AIX Technical Reference BACKUP(5,F)
FS_DS Specifies the node ID of the node being backed up and the full path
name of the directory that is being backed up. This header appears
only on the first volume.
FS_INODE Describes a single inode. This header is followed by data that
consists of directories then followed by the other files within the
directories.
FS_NAME A description of a file that is backed up by name.
FS_FINDEX An index of files on this volume. Multiple headers of this type can
appear on a volume if there are too many inodes for the initial
index. This header is followed by data.
FS_BIGCLRI Similar to FS_CLRI, except used in cases where the number of inodes
exceed 65,536.
FS_BIGBITS Similar to FS_BITS, except used in cases where the number of inodes
exceed 65,536.
Header Sequence
The header sequence varies depending on whether the files are backed up by
inode or by name and on the type of backup device used.
Volume 1 of inode backups to direct access volumes have the following sequence,
assuming that more than one volume is required for backup:
FS_VOLUME
FS_CLRI
FS_BITS
FS_FINDEX, followed by data
FS_FINDEX (if applicable), followed by data
FS_END
Subsequent volumes have the following sequence:
FS_VOLUME, followed by data
FS_FINDEX, followed by data
FS_FINDEX (if applicable), followed by data
FS_END
Inode backups to tapes have the same format as previously described, except
there are no FS_FINDEX headers and the FS_BITS header appears on every volume.
The format of backups by name does not depend on the output device. These
backups have a simple format:
FS_VOLUME Appears on each volume.
FS_DS Appears on the first volume.
Processed November 7, 1990 BACKUP(5,F) 2
BACKUP(5,F) AIX Technical Reference BACKUP(5,F)
FS_NAME Precedes the data for each file. The files are copied in the
order they were named.
FS_END Concludes the backup.
Header Format
The location and size of the headers are independent of any blocking for either
the file system or the backup device. Each header begins on an 8-byte
boundary. The length of a header depends on its type, but is always padded to
a multiple of 8 bytes. Data from a file is similarly padded. Some headers
contain addresses of other headers that are the offset in 8-byte units from the
beginning of the backup volume.
Each field in a header is written in low-order bytes first for portability.
Inode numbers within directories also follow this order. The header begins
with the following structure:
struct hdr {
unsigned char len;
unsigned char type;
ushort magic;
ushort checksum;
};
The fields in this header indicate the following information:
len The length of the header in 8-byte units.
type The type of the header.
magic The magic number, which identifies this file as a file system
backup. The magic number is one of the following values:
MAGIC Identifies this as a regular file system backup.
PACKED_MAGIC Identifies this as a packed, or compressed, file
system backup. Each data file within it is
compressed using the same algorithm that is used by
the pack command. Header information is not
compressed.
checksum A checksum.
Volume Headers
FS_VOLUME headers have the following structure:
struct {
struct hdr h;
ushort volnum;
time_t date;
Processed November 7, 1990 BACKUP(5,F) 3
BACKUP(5,F) AIX Technical Reference BACKUP(5,F)
time_t budate;
daddr_t numwds;
char disk[16];
char fsname[16];
char user[16];
short incno;
};
The fields contain the following information:
volnum Contains the volume number.
date Indicates the date the backup was made.
budate Indicates that all files changed since this date are backed up.
numwds Indicates the number of 8-byte words in this backup.
disk Identifies the device that was backed up.
fsname Identifies the logical name of the backed-up device, for example, "/a".
user Identifies the user that made the backup.
incno Shows the level number of the backup.
For backups by name, budate, disk, and fsname have no meaning, and incno is
100.
Index Headers
FS_FINDEX and FS_DFINDEX records are as follows:
struct {
struct hdr h;
ushort dummy;
ino_t ino[80];
daddr_t addr[80];
daddr_t link;
};
The fields are:
ino I-numbers of files indexed
addr Addresses of file indexed
link Address of next index on this volume, or 0 if this is the last.
Bit Maps
FS_CLRI and FS_BITS headers have the same structure:
Processed November 7, 1990 BACKUP(5,F) 4
BACKUP(5,F) AIX Technical Reference BACKUP(5,F)
struct {
struct hdr h;
ushort nwds;
};
In both cases, the bit map follows the header, and nwds gives the length of the
map in 8-byte units. To save space, some zero bits at the end of the map are
not backed up.
Location Headers
FS_DS headers have the following format:
struct {
struct hdr h;
char nid[8];
char qdir[2];
};
The fields in this header are:
nid Node ID of the system being backed up. For local files, this field
contains the node ID of the local system.
qdir Full path name of the directory that is being backed up, beginning at
the root directory.
File Headers
FS_INODE and FS_NAME headers have similar formats:
struct {
struct hdr h;
ulong ino;
ulong mode;
ushort nlink;
ulong uid;
ulong gid;
off_t size;
time_t atime;
time_t mtime;
time_t ctime;
ushort devmaj;
ushort devmin;
ushort rdevmaj;
ushort rdevmin;
off_t dsize;
ulong gen;
ulong cmtcnt;
ulong fstore;
ulong version;
Processed November 7, 1990 BACKUP(5,F) 5
BACKUP(5,F) AIX Technical Reference BACKUP(5,F)
ushort rdevsite;
char sbflag;
char pada;
char name[4];
};
The fields mode through ctime are based on the inode on disk.
Other fields are:
ino I-number of file.
devmaj,devmin Combined, these fields contain what is returned in st_dev by the
statx system call for this file.
rdevmaj Major device number of this file (character- and block-special
files only).
rdevmin Minor device number of this file (character- and block-special
files only).
dsize Size of the file after backup. This differs from size if the
file was compressed during backup.
gen Generation number of the inode which is a reuse count of the
inode slot.
cmtcnt Used in TCF replicated file systems. The sequence number within
the file system of the last commit to this file.
fstore Used in TCF replicated file systems. The storage attribute used
in determining where copies of the file are to be stored.
version Version of the file; sequence count of the number of commits on
this generation number; resets on the last unlink.
rdevsite Device site number. TCF cluster site number to which this
device is attached (character- and block-special files only).
name The null-terminated name of the file that is supplied by the
user. This field is absent from FS_INODE headers.
FS_DINODE and FS_DNAME headers have similar formats. They are used by the -c
flag of the backup command for compatibility with AIX/RT:
Processed November 7, 1990 BACKUP(5,F) 6
BACKUP(5,F) AIX Technical Reference BACKUP(5,F)
struct {
struct hdr h;
ushort ino;
ushort mode;
ushort nlink;
ushort uid;
ushort gid;
off_t size;
time_t atime;
time_t mtime;
time_t ctime;
ushort devmaj;
ushort devmin;
ushort rdevmaj;
ushort rdevmin;
off_t dsize;
char name[4];
};
End of Volume or Backup
FS_VOLEND and FS_END headers contain only the hdr structure.
Backup History
A backup history is kept in the /etc/budate file. The entries are in no
particular order. Each entry has the following format:
struct {
char id_name[16];
char id_incno;
time_t id_budate;
};
The fields of each entry are:
id_name Name of the file system
id_incno Incremental level number (0-9)
id_budate Date of most recent backup of the file system at that level.
RELATED INFORMATION
In this book: "filesystems."
The backup, pack, and restore commands in AIX Operating System Commands
Reference.
Processed November 7, 1990 BACKUP(5,F) 7