The typeflag byte at offset 156 of the
header says what kind of member it
describes. It is a single ASCII character. Some flags describe a file system object;
others mark a header that carries information about the member after it. The names in
the tables are those of the tar.h header file.
Files, links and folders
These are the flags of POSIX.1-1988, with the NUL of Version 7. The last column says whether data blocks follow the header.
| Flag | Name | Member | Description | Data |
|---|---|---|---|---|
0 (30) | REGTYPE | Regular file | The data blocks after the header are the file’s contents. | size bytes |
NUL (00) | AREGTYPE | Regular file | The old form of 0, kept for compatibility. In old archives a name ending in / is a folder. | size bytes |
1 | LNKTYPE | Hard link | Another name for a file stored earlier in the archive; linkname names it. | none (POSIX: size zero) |
2 | SYMTYPE | Symbolic link | linkname holds the link’s target. | none |
3 | CHRTYPE | Character device | devmajor and devminor give the device numbers. | none |
4 | BLKTYPE | Block device | As for a character device. | none |
5 | DIRTYPE | Directory | A folder. POSIX lets size give a space limit, zero for none; writers end the name with /. | none |
6 | FIFOTYPE | FIFO | A named pipe. | none |
7 | CONTTYPE | Contiguous file | Reserved by POSIX for high-performance files stored in one piece. Readers treat it as 0. | size bytes |
For types 1 to 6, Go and libarchive skip no data whatever
size says; one of Go’s test archives has a size of 5 on such members. The
explorer does the same, and follows the size only when the block after the header is
not a header and the block after the data would be, reporting it when it does.
Extended headers
POSIX.1-2001 added two flags for headers whose data is a list of key and value records. See pax extensions.
| Flag | Name | Header | Description |
|---|---|---|---|
x | XHDTYPE | Extended header | Records that apply to the next member only, such as its full path or exact size. |
g | XGLTYPE | Global extended header | Records that apply to every following member, until changed by another g header. |
X | SOLARIS_XHDTYPE | Solaris extended header | Written by Sun’s tar. libarchive reads it like x (“Used by SUN tar; same as ‘x’.”), and so does the explorer. |
Vendor flags
POSIX reserves the capital letters A to Z for custom
implementations, and other values for future use. A reader that meets a flag it does
not know must extract the member as a regular file if its size says data follows, and
the pax utility must report it; libarchive’s tar(5) puts it as “A
POSIX-compliant implementation must treat any unrecognized typeflag value as a
regular file.” This is why an old program extracting a pax archive leaves small extra
files named after the pax headers.
These are the vendor flags readers meet in ustar archives. Most belong to other formats, and the explorer links each to its page there.
| Flag | From | Meaning |
|---|---|---|
A | Solaris | An access control list. tar(5): the data is a seven-digit octal number and a NUL, then the ACL; 01000000 means a POSIX.1e ACL, 03000000 an NFSv4 one. AIX also writes A, after the file’s data. |
D | GNU tar | A dump directory in an incremental backup. |
E | Solaris | An extended attribute file (named in star’s documentation). |
I | star | Inode metadata only, with no data, usually after an x header; used by incremental backups. |
K | GNU tar | Its data is the long link target of the next member. |
L | GNU tar | Its data is the long name of the next member. |
M | GNU tar | The rest of a file begun on the previous volume of a multi-volume archive. |
N | GNU tar | An old way of storing long names; tar(5): “no longer generated”, and generally ignored when reading. |
S | GNU tar | A sparse file, with only the parts that hold data stored. |
V | GNU tar | A volume label, held in name. |
In a pax archive the same information has standard places: long names in
path and linkpath records, and sparse files in
GNU.sparse.
records.