| 1 | |
| 2 | |
| 3 | |
| 4 | TAR(5) 1985 TAR(5) |
| 5 | |
| 6 | |
| 7 | |
| 8 | N\bNA\bAM\bME\bE |
| 9 | tar - tape archive file format |
| 10 | |
| 11 | D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN |
| 12 | _\bT_\ba_\br, (the tape archive command) dumps several files into |
| 13 | one, in a medium suitable for transportation. |
| 14 | |
| 15 | A ``tar tape'' or file is a series of blocks. Each block is |
| 16 | of size TBLOCK. A file on the tape is represented by a |
| 17 | header block which describes the file, followed by zero or |
| 18 | more blocks which give the contents of the file. At the end |
| 19 | of the tape are two blocks filled with binary zeros, as an |
| 20 | end-of-file indicator. |
| 21 | |
| 22 | The blocks are grouped for physical I/O operations. Each |
| 23 | group of _\bn blocks (where _\bn is set by the b\bb keyletter on the |
| 24 | _\bt_\ba_\br(1) command line - default is 20 blocks) is written with |
| 25 | a single system call; on nine-track tapes, the result of |
| 26 | this write is a single tape record. The last group is |
| 27 | always written at the full size, so blocks after the two |
| 28 | zero blocks contain random data. On reading, the specified |
| 29 | or default group size is used for the first read, but if |
| 30 | that read returns less than a full tape block, the reduced |
| 31 | block size is used for further reads. |
| 32 | |
| 33 | The header block looks like: |
| 34 | |
| 35 | #define TBLOCK 512 |
| 36 | #define NAMSIZ 100 |
| 37 | |
| 38 | union hblock { |
| 39 | char dummy[TBLOCK]; |
| 40 | struct header { |
| 41 | char name[NAMSIZ]; |
| 42 | char mode[8]; |
| 43 | char uid[8]; |
| 44 | char gid[8]; |
| 45 | char size[12]; |
| 46 | char mtime[12]; |
| 47 | char chksum[8]; |
| 48 | char linkflag; |
| 49 | char linkname[NAMSIZ]; |
| 50 | } dbuf; |
| 51 | }; |
| 52 | |
| 53 | _\bN_\ba_\bm_\be is a null-terminated string. The other fields are |
| 54 | zero-filled octal numbers in ASCII. Each field (of width w) |
| 55 | contains w-2 digits, a space, and a null, except _\bs_\bi_\bz_\be and |
| 56 | _\bm_\bt_\bi_\bm_\be, which do not contain the trailing null and _\bc_\bh_\bk_\bs_\bu_\bm |
| 57 | which has a null followed by a space. _\bN_\ba_\bm_\be is the name of |
| 58 | the file, as specified on the _\bt_\ba_\br command line. Files |
| 59 | dumped because they were in a directory which was named in |
| 60 | |
| 61 | |
| 62 | |
| 63 | Printed 7/27/90 November 1 |
| 64 | |
| 65 | |
| 66 | |
| 67 | |
| 68 | |
| 69 | |
| 70 | TAR(5) 1985 TAR(5) |
| 71 | |
| 72 | |
| 73 | |
| 74 | the command line have the directory name as prefix and |
| 75 | /_\bf_\bi_\bl_\be_\bn_\ba_\bm_\be as suffix. _\bM_\bo_\bd_\be is the file mode, with the top |
| 76 | bit masked off. _\bU_\bi_\bd and _\bg_\bi_\bd are the user and group numbers |
| 77 | which own the file. _\bS_\bi_\bz_\be is the size of the file in bytes. |
| 78 | Links and symbolic links are dumped with this field speci- |
| 79 | fied as zero. _\bM_\bt_\bi_\bm_\be is the modification time of the file at |
| 80 | the time it was dumped. _\bC_\bh_\bk_\bs_\bu_\bm is an octal ASCII value |
| 81 | which represents the sum of all the bytes in the header |
| 82 | block. When calculating the checksum, the _\bc_\bh_\bk_\bs_\bu_\bm field is |
| 83 | treated as if it were all blanks. _\bL_\bi_\bn_\bk_\bf_\bl_\ba_\bg is NULL if the |
| 84 | file is ``normal'' or a special file, ASCII `1' if it is an |
| 85 | hard link, and ASCII `2' if it is a symbolic link. The name |
| 86 | linked-to, if any, is in _\bl_\bi_\bn_\bk_\bn_\ba_\bm_\be, with a trailing null. |
| 87 | Unused fields of the header are binary zeros (and are |
| 88 | included in the checksum). |
| 89 | |
| 90 | The first time a given i-node number is dumped, it is dumped |
| 91 | as a regular file. The second and subsequent times, it is |
| 92 | dumped as a link instead. Upon retrieval, if a link entry |
| 93 | is retrieved, but not the file it was linked to, an error |
| 94 | message is printed and the tape must be manually re-scanned |
| 95 | to retrieve the linked-to file. |
| 96 | |
| 97 | The encoding of the header is designed to be portable across |
| 98 | machines. |
| 99 | |
| 100 | S\bSE\bEE\bE A\bAL\bLS\bSO\bO |
| 101 | tar(1) |
| 102 | |
| 103 | B\bBU\bUG\bGS\bS |
| 104 | Names or linknames longer than NAMSIZ produce error reports |
| 105 | and cannot be dumped. |
| 106 | |
| 107 | |
| 108 | |
| 109 | |
| 110 | |
| 111 | |
| 112 | |
| 113 | |
| 114 | |
| 115 | |
| 116 | |
| 117 | |
| 118 | |
| 119 | |
| 120 | |
| 121 | |
| 122 | |
| 123 | |
| 124 | |
| 125 | |
| 126 | |
| 127 | |
| 128 | |
| 129 | Printed 7/27/90 November 2 |
| 130 | |
| 131 | |
| 132 | |