Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ backup(5) — AIX/RT 2.2.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

filesystems

backup

pack

restore

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,  con-
     versely, 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_FINDEX   An index  of files on this  volume.  Multiple
                 headers of  this type can appear  on a volume
                 if there are too many i-nodes for the initial
                 index.  This header is followed by data.

     FS_CLRI     A bit map  of i-nodes on the  file system.  A
                 zero bit indicates the  i-node 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  i-nodes.  A one bit indi-
                 cates the i-node is present on this volume or
                 a  subsequent volume.   This  header may  not
                 appear on all volumes.

     FS_DS       Specifies  the  node  ID of  the  node  being
                 backed up and the full pathname of the direc-
                 tory that  is being  backed up.   This header
                 appears only on the first volume.

     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_INODE    Describes  a single  i-node.  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.

     Header Sequence

     The header sequence varies depending on whether the files
     are backed  up by i-node  or by name  and on the  type of
     backup device used.

     Volume 1 of i-node 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

     I-node backups  to tapes have  the same format  as previ-
     ously 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.

     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.  I-node numbers within directories
     also follow this order.  The  header begins with the fol-
     lowing structure:

          struct hdr {
                 unsigned char  len;
                 unsigned char  type;
                 ushort         magic;
                 ushort         checksum;
          };

     The fields in this header indicate the following informa-
     tion:

     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;
                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 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:

          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 pathname  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;
             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];
          };

     The fields mode through ctime  are copied from the i-node
     on disk.

     Other fields are:

     ino          I-number of file.

     devmaj       Major  device  number  of file  system  con-
                  taining this file.

     devmin       Minor  device  number  of file  system  con-
                  taining 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.

     name         The null-terminated name of the file that is
                  supplied by the user.   This field is absent
                  from FS_INODE headers.

     End of Volume or Backup

     FS_VOLEND and FS_END headers  contain only the hdr struc-
     ture.

     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.

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026