Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ tar(5) — Ultrix-11 3.0

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

tar(1)

tar(5)

NAME

tar − tape archive file formats

DESCRIPTION

An archive tape or file is a series of blocks.  Each block is of TBLOCK bytes in length.  A file on the tape is represented by a header block which describes the file, followed by zero or more blocks which give the contents of the file.  At the end of the tape are three blocks filled with binary zeros, as an end-of-file indicator. 

The tar command supports multivolume operations. That is, when the current archive media is filled on output, tar requests that the user change archive media to continue.  This further implies that a file may be split between two physical reels of tape or disks.  If a file is continued on another volume, the two zero filled blocks that normally end a volume are followed by an End Of Volume block (EOV). An EOV block contains the name of the file that is being continued to the next media (in the usual place) while the remainder of the block is filled with ASCII zeros.  This applies to disks only.  On tapes, tar does not output any end blocks after EOT.  The handler will complete the current data block after the EOT, and tar will place a continuation header on the next tape volume.  Multivolume logic is suppressed if the output is directed to a pipe. 

The blocks are grouped for physical I/O operations.  Each group of n blocks are written with a single system call.  n is set by the b modifier specified on the command line.  The default is 20 blocks.  On nine-track tapes, the result of this write is a single tape record.  The last group is always written at the full size, so blocks after the three zero blocks contain random data.  On reading, the specified or default block size is used for the first read, but if that read returns less than a full tape block, the reduced block size is used for further reads. 

The header block contains:

#define NAMSIZ  100
#define TBLOCK  512
#define TCKSLEN 8
#define TDEVLEN 8
#define TGIDLEN 8
#define TGNMLEN 32
#define TMAGIC  "ustar  "
#define TMAGLEN 8
#define TMTMLEN 12
#define TMODLEN 8
#define TSIZLEN 12
#define TUIDLEN 8
#define TUNMLEN 32
#define TVLEN   3
 union hblock {
    char dummy[TBLOCK];
        struct header {
           char name[NAMSIZ];  /* Pathname of file */
          char mode[TMODLEN]; /* Permissions/modes of file */
          char uid[TUIDLEN];  /* User ID of file owner */
          char gid[TGIDLEN];  /* Group ID of file owner */
          char size[TSIZLEN]; /* Number of bytes in file */
          char mtime[TMTMLEN];/* Modification time of file */
          char chksum[TCKSLEN];/* Check-sum for header values */
          char typeflag;       /* Specifies this files’ type
                                * Formerly named -> linkflag */
          char linkname[NAMSIZ];/* Linked-to file name */
          /*
           * Point of departure from very old original
           * tar  header format and older Ultrix format.
           * Start of User Group standard extension fields.
           */
          char magic[TMAGLEN];  /* Value == TMAGIC to identify
                                 * new archive format
                                 * Is rdev[6] field for older
                                 * Ultrix volume formats */
          char uname[TUNMLEN];  /* File owner user name */
          char gname[TGNMLEN];  /* File owner group name */
                                /* Next 2 fields apply only to
                                 * device special files. */
          char devmajor[TDEVLEN];/* Major device number */
          char devminor[TDEVLEN];/* Minor device number */
          /*
           * Point of departure from User Group standard
           * extension fields.
           * Start of  ULTRIX  multi-volume extension fields.
           */
          char UEGdummy[1];/* Dummy chctr to align UEG fields  */
                           /* Volume numbers are ASCII 01 - 99 */
          char cvol[TVLEN];/* Number of this (current) volume */
          char ovol[TVLEN];/* Orginal volume number on which
                            * file was begun */
          char org_size[TSIZLEN];/* Original size of file if
                                  * this is a continued file. */
    } dbuf;
};

name Contains a null-terminated string that is the name of the file, as specified on the command line.  The other fields are zero-filled octal numbers in ASCII.  Each field (of width w) contains w-2 digits, a space, and a null, except size, org_size, and mtime, which do not contain the trailing null.  Files dumped because they were in a directory which was named in the command line have the directory name as prefix and /filename as suffix. 

mode Provides nine bits specifying file permissions and three bits to specify the Set_UID, Set_GID, and Save Text modes. When  special permissions are required to create a file with a given mode, and the user restoring files from the archive does not hold such permissions, the mode bit(s) specifying those special permissions are ignored. 

uid Contains the user ID of the file owners. 

gid Contains the group ID of the file owners. 

size Contains the size of the file in bytes.  For tape media, it contains the original file size.  If the file is continued to another tape, the continuation header contains the size placed on that tape.  For nontape media, where the number of blocks can be calculated in advance, it contains the number of bytes on that media.  If the file is continued to the next media, the continuation header contains the size placed on that media.  Links, symbolic links, and directories are dumped with this field specified as zero. 

mtime Contains the modification time of the file at the time it was archived. 

chksum Contains a decimal ASCII value which represents the sum of all the bytes in the header block.  When calculating the checksum, the chksum field is treated as if it were all blanks. 

typeflag Defines the type of file:

binary zero =  a regular file
ASCII space =  a regular file
ASCII one   =  a hard link file
ASCII two   =  a symbolic link file
ASCII three =  a character special file
ASCII four  =  a block special file
ASCII five  =  a directory file
ASCII six   =  a FIFO special file
ASCII seven =  a contiguous file

linkname Contains, if present, the null-terminated name of a file linked-to by the current file. 

magic Specifies the /USER/GROUP standard archive formats is to be used. If this field contains TMAGIC, then the uname and gname fields will contain the ASCII representation of the owner and group of the file respectively. When the file is restored, the password and group file are scanned for these names, unless the N option is specified.  For further information, see tar(1).  If found, the user and group IDs contained within these files will be used rather than the values contained within the uid and gid fields.  If the N option is specified, the values from the tar file header block are used as in v7tar. User names longer than TUNMLEN-1 or group names longer than TGNMLEN-1 characters will be truncated. 

devmajor Contains the major device numbers if typeflag identifies the file as a character or block special file. 

devminor Contains the minor device numbers if typeflag identifies the file as a character or block special file. 

UEGdummy
Meaning undefined: used as a separator character.

cvol Contains the ASCII representation of the current (this) volume number.  This value is displayed for the first file on the archive if the V modifier was specified.  This field is used to identify the correct sequence of archive volumes when restoring a multi-volume archive set. 

ovol Contains the ASCII representation of the original volume number on which the current file was begun. If the current file was not continued from a previous volume, this value will contain ASCII zeroes. 

org_size Contains the original size of the file if this (the current) file was continued from a previous volume. This value is used to ensure that all of the original file is extracted. If the size of the file at the time the last portion is extracted does not match this value, an error message is printed to warn the user that not all of the file was extracted. 

Unused fields of the header are binary zeros (and are included in the checksum). 

The first time a given inode number is dumped, it is dumped as a regular file.  The second and subsequent times, it is dumped as a link instead.  Upon retrieval, if a link entry is retrieved, but not the file it was linked to, an error message is printed and the tape must be manually re-scanned to retrieve the linked-to file. 

The encoding of the header is designed to be portable across machines. 

RESTRICTIONS

Names or linknames longer than NAMSIZ produce error messages and cannot be dumped. 

SEE ALSO

tar(1)

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