tar(5) DG/UX 5.4R3.00 tar(5)
NAME
tar - tape archive file format
DESCRIPTION
tar (the tape archive command) dumps several files into one, in a
medium suitable for transportation.
A ``tar tape'' or file is a series of blocks. Each block is of size
TBLOCK. 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 two blocks filled
with binary zeros, as an end-of-file indicator.
The blocks are grouped for physical I/O operations. Each group of n
blocks (where n is set by the b keyletter on the tar(1) command line
-- default is 32 blocks) is written with a single system call; 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 two zero blocks contain random data. On reading, the specified
or default group 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 looks like:
#define TBLOCK 512 /* length of tar header and data blocks */
#define TNAMLEN 100 /* maximum length for tar file names */
#define TMODLEN 8 /* length of mode field */
#define TUIDLEN 8 /* length of uid field */
#define TGIDLEN 8 /* length of gid field */
#define TSIZLEN 12 /* length of size field */
#define TTIMLEN 12 /* length of modification time field */
#define TCRCLEN 8 /* length of header checksum field */
#define TMAGIC "ustar" /* string in magic field */
#define TMAGLEN 6 /* length of magic field, with trailing null */
#define TVERSION "00" /* string in version field */
#define TVERSLEN 2 /* length of version field, no trailing null */
union tblock {
char dummy[TBLOCK];
struct tarhdr {
char tname[TNAMLEN], /* name of file */
tmode[TMODLEN], /* mode of file */
tuid[TUIDLEN], /* uid of file */
tgid[TGIDLEN], /* gid of file */
tsize[TSIZLEN], /* size of file in bytes */
tmtime[TTIMLEN], /* modification time of file */
tcksum[TCRCLEN], /* checksum of header */
ttypeflag,
tlinkname[TNAMLEN], /* file this file linked with */
tmagic[TMAGLEN],
tversion[TVERSLEN],
tuname[32],
tgname[32],
Licensed material--property of copyright holder(s) 1
tar(5) DG/UX 5.4R3.00 tar(5)
tdevmajor[8],
tdevminor[8],
tprefix[155];
} tbuf;
} ;
The fields tmagic, tuname, and tgname are null-terminated strings.
The fields tname, tlinkname, and tprefix are null-terminated
except when all characters in the field, including the last
character, are used for the name.
The tname and tprefix fields are used to construct the pathname of
the file. If the tprefix field contains non-null characters, a
pathname is formed by concatenating the tprefix field, a slash
character, and the tname field; otherwise, the pathname is formed
using only the value in the tname field.
Tmode is the file mode, with the top bit masked off.
Uid and gid are the user and group numbers for the file.
Tsize is the size of the file in bytes (or the size of the current
extension of the file if the file has been split over multiple
volumes). Links, symbolic links, directories, and device files are
dumped with this field specified as zero.
Tmtime is the modification time of the file at the time it was
dumped.
Tchksum is an octal ASCII value which represents the sum of all the
bytes in the header block. When calculating the checksum, the
tchksum field is treated as if it were all blanks.
Ttypeflag is a one-character field which specifies the type of the
file. The valid values for ttypeflag are:
null Regular file (supplied for backward compatibility)
`0' Regular file
`1' Link
`2' Symbolic link
`3' Character special
`4' Block special
`5' Directory
`6' FIFO special
`7' Reserved
If typeflag is ASCII `1' (hard link) or ASCII `2' (symbolic link),
the name linked-to, is in tlinkname, with a trailing null. The
tlinkname field does not use the tprefix; hence, linknames are
limited to 99 characters.
Tmagic indicates that the archive was output in this archive format.
If the tmagic field contains the value TMAGIC (defined above), then
the tuname and tgname fields contain the ASCII names of the owner
Licensed material--property of copyright holder(s) 2
tar(5) DG/UX 5.4R3.00 tar(5)
and group, respectively, for the file. If necessary, the owner and
group names will be truncated to fit in these fields.
Tversion should contain the value TVERSION (defined above).
Tdevmajor and Tdevminor contain the major and minor device codes,
respectively, for device files and are meaningful only if Ttypeflag
is ASCII `3' (character special) or ASCII `4' (block special).
The fields textno, extotal and efsize are used for files which are
split over multiple volumes. The extensions (pieces) of the file are
labeled separately on each volume and assigned sequential extension
numbers. textno contains the extension number of the current
extension and is null if the file is not split; textotal contains
the total number of extensions for the file; and tefsize contains
the total size of the file.
Unused fields of the header are set to binary zeros and are included
in the checksum.
The first time a given i-node 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.
SEE ALSO
tar(1).
NOTE
Linknames longer than NAMSIZ produce error reports and cannot be
dumped.
Licensed material--property of copyright holder(s) 3