1TAR(5)                        File Formats Manual                       TAR(5)
2
3
4

NAME

6       tar - tape archive file format
7

DESCRIPTION

9       Tar,  (the  tape  archive  command)  dumps several files into one, in a
10       medium suitable for transportation.
11
12       A ``tar tape'' or file is a series of blocks.  Each block  is  of  size
13       TBLOCK.   A  file  on  the  tape is represented by a header block which
14       describes the file, followed by zero or more blocks which give the con‐
15       tents  of  the file.  At the end of the tape are two blocks filled with
16       binary zeros, as an end-of-file indicator.
17
18       The blocks are grouped for physical I/O operations.  Each  group  of  n
19       blocks  (where n is set by the b keyletter on the tar(1) command line —
20       default is 20 blocks) is written with a single system  call;  on  nine-
21       track  tapes,  the  result  of this write is a single tape record.  The
22       last group is always written at the full size, so blocks after the  two
23       zero  blocks contain random data.  On reading, the specified or default
24       group size is used for the first read, but if that  read  returns  less
25       than  a  full  tape  block,  the reduced block size is used for further
26       reads.
27
28       The header block looks like:
29
30              #define TBLOCK 512
31              #define NAMSIZ 100
32
33              union hblock {
34                   char dummy[TBLOCK];
35                   struct header {
36                        char name[NAMSIZ];
37                        char mode[8];
38                        char uid[8];
39                        char gid[8];
40                        char size[12];
41                        char mtime[12];
42                        char chksum[8];
43                        char linkflag;
44                        char linkname[NAMSIZ];
45                   } dbuf;
46              };
47
48       Name is a null-terminated string.  The  other  fields  are  zero-filled
49       octal numbers in ASCII.  Each field (of width w) contains w-2 digits, a
50       space, and a null, except size and mtime,  which  do  not  contain  the
51       trailing null and chksum which has a null followed by a space.  Name is
52       the name of the file, as specified on  the  tar  command  line.   Files
53       dumped  because they were in a directory which was named in the command
54       line have the directory name as prefix and /filename as  suffix.   Mode
55       is  the  file  mode,  with the top bit masked off.  Uid and gid are the
56       user and group numbers which own the file.  Size is  the  size  of  the
57       file  in  bytes.   Links  and symbolic links are dumped with this field
58       specified as zero.  Mtime is the modification time of the file  at  the
59       time  it  was  dumped.  Chksum is an octal ASCII value which represents
60       the sum of all the bytes in the header  block.   When  calculating  the
61       checksum,  the chksum field is treated as if it were all blanks.  Link‐
62       flag is NULL if the file is ``normal'' or a special file, ASCII `1'  if
63       it  is  an hard link, and ASCII `2' if it is a symbolic link.  The name
64       linked-to, if any, is in linkname, with a trailing null.  Unused fields
65       of the header are binary zeros (and are included in the checksum).
66
67       The first time a given i-node number is dumped, it is dumped as a regu‐
68       lar file.  The second and subsequent times, it  is  dumped  as  a  link
69       instead.   Upon  retrieval,  if  a link entry is retrieved, but not the
70       file it was linked to, an error message is printed and the tape must be
71       manually re-scanned to retrieve the linked-to file.
72
73       The encoding of the header is designed to be portable across machines.
74

SEE ALSO

76       tar(1)
77

BUGS

79       Names  or linknames longer than NAMSIZ produce error reports and cannot
80       be dumped.
81
82
83
844.2 Berkeley Distribution      November 7, 1985                         TAR(5)
Impressum