1TAR(5)                      BSD File Formats Manual                     TAR(5)
2

NAME

4     tar — format of tape archive files
5

DESCRIPTION

7     The tar archive format collects any number of files, directories, and
8     other file system objects (symbolic links, device nodes, etc.) into a
9     single stream of bytes.  The format was originally designed to be used
10     with tape drives that operate with fixed-size blocks, but is widely used
11     as a general packaging mechanism.
12
13   General Format
14     A tar archive consists of a series of 512-byte records.  Each file system
15     object requires a header record which stores basic metadata (pathname,
16     owner, permissions, etc.) and zero or more records containing any file
17     data.  The end of the archive is indicated by two records consisting
18     entirely of zero bytes.
19
20     For compatibility with tape drives that use fixed block sizes, programs
21     that read or write tar files always read or write a fixed number of
22     records with each I/O operation.  These “blocks” are always a multiple of
23     the record size.  The maximum block size supported by early implementa‐
24     tions was 10240 bytes or 20 records.  This is still the default for most
25     implementations although block sizes of 1MiB (2048 records) or larger are
26     commonly used with modern high-speed tape drives.  (Note: the terms
27     “block” and “record” here are not entirely standard; this document fol‐
28     lows the convention established by John Gilmore in documenting pdtar.)
29
30   Old-Style Archive Format
31     The original tar archive format has been extended many times to include
32     additional information that various implementors found necessary.  This
33     section describes the variant implemented by the tar command included in
34     Version 7 AT&T UNIX, which seems to be the earliest widely-used version
35     of the tar program.
36
37     The header record for an old-style tar archive consists of the following:
38
39           struct header_old_tar {
40                   char name[100];
41                   char mode[8];
42                   char uid[8];
43                   char gid[8];
44                   char size[12];
45                   char mtime[12];
46                   char checksum[8];
47                   char linkflag[1];
48                   char linkname[100];
49                   char pad[255];
50           };
51     All unused bytes in the header record are filled with nulls.
52
53     name    Pathname, stored as a null-terminated string.  Early tar imple‐
54             mentations only stored regular files (including hardlinks to
55             those files).  One common early convention used a trailing "/"
56             character to indicate a directory name, allowing directory per‐
57             missions and owner information to be archived and restored.
58
59     mode    File mode, stored as an octal number in ASCII.
60
61     uid, gid
62             User id and group id of owner, as octal numbers in ASCII.
63
64     size    Size of file, as octal number in ASCII.  For regular files only,
65             this indicates the amount of data that follows the header.  In
66             particular, this field was ignored by early tar implementations
67             when extracting hardlinks.  Modern writers should always store a
68             zero length for hardlink entries.
69
70     mtime   Modification time of file, as an octal number in ASCII.  This
71             indicates the number of seconds since the start of the epoch,
72             00:00:00 UTC January 1, 1970.  Note that negative values should
73             be avoided here, as they are handled inconsistently.
74
75     checksum
76             Header checksum, stored as an octal number in ASCII.  To compute
77             the checksum, set the checksum field to all spaces, then sum all
78             bytes in the header using unsigned arithmetic.  This field should
79             be stored as six octal digits followed by a null and a space
80             character.  Note that many early implementations of tar used
81             signed arithmetic for the checksum field, which can cause inter‐
82             operability problems when transferring archives between systems.
83             Modern robust readers compute the checksum both ways and accept
84             the header if either computation matches.
85
86     linkflag, linkname
87             In order to preserve hardlinks and conserve tape, a file with
88             multiple links is only written to the archive the first time it
89             is encountered.  The next time it is encountered, the linkflag is
90             set to an ASCII ‘1’ and the linkname field holds the first name
91             under which this file appears.  (Note that regular files have a
92             null value in the linkflag field.)
93
94     Early tar implementations varied in how they terminated these fields.
95     The tar command in Version 7 AT&T UNIX used the following conventions
96     (this is also documented in early BSD manpages): the pathname must be
97     null-terminated; the mode, uid, and gid fields must end in a space and a
98     null byte; the size and mtime fields must end in a space; the checksum is
99     terminated by a null and a space.  Early implementations filled the
100     numeric fields with leading spaces.  This seems to have been common prac‐
101     tice until the IEEE Std 1003.1-1988 (“POSIX.1”) standard was released.
102     For best portability, modern implementations should fill the numeric
103     fields with leading zeros.
104
105   Pre-POSIX Archives
106     An early draft of IEEE Std 1003.1-1988 (“POSIX.1”) served as the basis
107     for John Gilmore's pdtar program and many system implementations from the
108     late 1980s and early 1990s.  These archives generally follow the POSIX
109     ustar format described below with the following variations:
110     ·       The magic value consists of the five characters “ustar” followed
111             by a space.  The version field contains a space character fol‐
112             lowed by a null.
113     ·       The numeric fields are generally filled with leading spaces (not
114             leading zeros as recommended in the final standard).
115     ·       The prefix field is often not used, limiting pathnames to the 100
116             characters of old-style archives.
117
118   POSIX ustar Archives
119     IEEE Std 1003.1-1988 (“POSIX.1”) defined a standard tar file format to be
120     read and written by compliant implementations of tar(1).  This format is
121     often called the “ustar” format, after the magic value used in the
122     header.  (The name is an acronym for “Unix Standard TAR”.)  It extends
123     the historic format with new fields:
124
125           struct header_posix_ustar {
126                   char name[100];
127                   char mode[8];
128                   char uid[8];
129                   char gid[8];
130                   char size[12];
131                   char mtime[12];
132                   char checksum[8];
133                   char typeflag[1];
134                   char linkname[100];
135                   char magic[6];
136                   char version[2];
137                   char uname[32];
138                   char gname[32];
139                   char devmajor[8];
140                   char devminor[8];
141                   char prefix[155];
142                   char pad[12];
143           };
144
145     typeflag
146             Type of entry.  POSIX extended the earlier linkflag field with
147             several new type values:
148             “0”     Regular file.  NUL should be treated as a synonym, for
149                     compatibility purposes.
150             “1”     Hard link.
151             “2”     Symbolic link.
152             “3”     Character device node.
153             “4”     Block device node.
154             “5”     Directory.
155             “6”     FIFO node.
156             “7”     Reserved.
157             Other   A POSIX-compliant implementation must treat any unrecog‐
158                     nized typeflag value as a regular file.  In particular,
159                     writers should ensure that all entries have a valid file‐
160                     name so that they can be restored by readers that do not
161                     support the corresponding extension.  Uppercase letters
162                     "A" through "Z" are reserved for custom extensions.  Note
163                     that sockets and whiteout entries are not archivable.
164             It is worth noting that the size field, in particular, has dif‐
165             ferent meanings depending on the type.  For regular files, of
166             course, it indicates the amount of data following the header.
167             For directories, it may be used to indicate the total size of all
168             files in the directory, for use by operating systems that pre-
169             allocate directory space.  For all other types, it should be set
170             to zero by writers and ignored by readers.
171
172     magic   Contains the magic value “ustar” followed by a NUL byte to indi‐
173             cate that this is a POSIX standard archive.  Full compliance
174             requires the uname and gname fields be properly set.
175
176     version
177             Version.  This should be “00” (two copies of the ASCII digit
178             zero) for POSIX standard archives.
179
180     uname, gname
181             User and group names, as null-terminated ASCII strings.  These
182             should be used in preference to the uid/gid values when they are
183             set and the corresponding names exist on the system.
184
185     devmajor, devminor
186             Major and minor numbers for character device or block device
187             entry.
188
189     name, prefix
190             If the pathname is too long to fit in the 100 bytes provided by
191             the standard format, it can be split at any / character with the
192             first portion going into the prefix field.  If the prefix field
193             is not empty, the reader will prepend the prefix value and a /
194             character to the regular name field to obtain the full pathname.
195             The standard does not require a trailing / character on directory
196             names, though most implementations still include this for compat‐
197             ibility reasons.
198
199     Note that all unused bytes must be set to NUL.
200
201     Field termination is specified slightly differently by POSIX than by pre‐
202     vious implementations.  The magic, uname, and gname fields must have a
203     trailing NUL.  The pathname, linkname, and prefix fields must have a
204     trailing NUL unless they fill the entire field.  (In particular, it is
205     possible to store a 256-character pathname if it happens to have a / as
206     the 156th character.)  POSIX requires numeric fields to be zero-padded in
207     the front, and requires them to be terminated with either space or NUL
208     characters.
209
210     Currently, most tar implementations comply with the ustar format, occa‐
211     sionally extending it by adding new fields to the blank area at the end
212     of the header record.
213
214   Numeric Extensions
215     There have been several attempts to extend the range of sizes or times
216     supported by modifying how numbers are stored in the header.
217
218     One obvious extension to increase the size of files is to eliminate the
219     terminating characters from the various numeric fields.  For example, the
220     standard only allows the size field to contain 11 octal digits, reserving
221     the twelfth byte for a trailing NUL character.  Allowing 12 octal digits
222     allows file sizes up to 64 GB.
223
224     Another extension, utilized by GNU tar, star, and other newer tar imple‐
225     mentations, permits binary numbers in the standard numeric fields.  This
226     is flagged by setting the high bit of the first byte.  The remainder of
227     the field is treated as a signed twos-complement value.  This permits
228     95-bit values for the length and time fields and 63-bit values for the
229     uid, gid, and device numbers.  In particular, this provides a consistent
230     way to handle negative time values.  GNU tar supports this extension for
231     the length, mtime, ctime, and atime fields.  Joerg Schilling's star pro‐
232     gram and the libarchive library support this extension for all numeric
233     fields.  Note that this extension is largely obsoleted by the extended
234     attribute record provided by the pax interchange format.
235
236     Another early GNU extension allowed base-64 values rather than octal.
237     This extension was short-lived and is no longer supported by any imple‐
238     mentation.
239
240   Pax Interchange Format
241     There are many attributes that cannot be portably stored in a POSIX ustar
242     archive.  IEEE Std 1003.1-2001 (“POSIX.1”) defined a “pax interchange
243     format” that uses two new types of entries to hold text-formatted meta‐
244     data that applies to following entries.  Note that a pax interchange for‐
245     mat archive is a ustar archive in every respect.  The new data is stored
246     in ustar-compatible archive entries that use the “x” or “g” typeflag.  In
247     particular, older implementations that do not fully support these exten‐
248     sions will extract the metadata into regular files, where the metadata
249     can be examined as necessary.
250
251     An entry in a pax interchange format archive consists of one or two stan‐
252     dard ustar entries, each with its own header and data.  The first
253     optional entry stores the extended attributes for the following entry.
254     This optional first entry has an "x" typeflag and a size field that indi‐
255     cates the total size of the extended attributes.  The extended attributes
256     themselves are stored as a series of text-format lines encoded in the
257     portable UTF-8 encoding.  Each line consists of a decimal number, a
258     space, a key string, an equals sign, a value string, and a new line.  The
259     decimal number indicates the length of the entire line, including the
260     initial length field and the trailing newline.  An example of such a
261     field is:
262           25 ctime=1084839148.1212\n
263     Keys in all lowercase are standard keys.  Vendors can add their own keys
264     by prefixing them with an all uppercase vendor name and a period.  Note
265     that, unlike the historic header, numeric values are stored using deci‐
266     mal, not octal.  A description of some common keys follows:
267
268     atime, ctime, mtime
269             File access, inode change, and modification times.  These fields
270             can be negative or include a decimal point and a fractional
271             value.
272
273     hdrcharset
274             The character set used by the pax extension values.  By default,
275             all textual values in the pax extended attributes are assumed to
276             be in UTF-8, including pathnames, user names, and group names.
277             In some cases, it is not possible to translate local conventions
278             into UTF-8.  If this key is present and the value is the six-
279             character ASCII string “BINARY”, then all textual values are
280             assumed to be in a platform-dependent multi-byte encoding.  Note
281             that there are only two valid values for this key: “BINARY” or
282             “ISO-IR 10646 2000 UTF-8”.  No other values are permitted by the
283             standard, and the latter value should generally not be used as it
284             is the default when this key is not specified.  In particular,
285             this flag should not be used as a general mechanism to allow
286             filenames to be stored in arbitrary encodings.
287
288     uname, uid, gname, gid
289             User name, group name, and numeric UID and GID values.  The user
290             name and group name stored here are encoded in UTF8 and can thus
291             include non-ASCII characters.  The UID and GID fields can be of
292             arbitrary length.
293
294     linkpath
295             The full path of the linked-to file.  Note that this is encoded
296             in UTF8 and can thus include non-ASCII characters.
297
298     path    The full pathname of the entry.  Note that this is encoded in
299             UTF8 and can thus include non-ASCII characters.
300
301     realtime.*, security.*
302             These keys are reserved and may be used for future standardiza‐
303             tion.
304
305     size    The size of the file.  Note that there is no length limit on this
306             field, allowing conforming archives to store files much larger
307             than the historic 8GB limit.
308
309     SCHILY.*
310             Vendor-specific attributes used by Joerg Schilling's star imple‐
311             mentation.
312
313     SCHILY.acl.access, SCHILY.acl.default
314             Stores the access and default ACLs as textual strings in a format
315             that is an extension of the format specified by POSIX.1e draft
316             17.  In particular, each user or group access specification can
317             include a fourth colon-separated field with the numeric UID or
318             GID.  This allows ACLs to be restored on systems that may not
319             have complete user or group information available (such as when
320             NIS/YP or LDAP services are temporarily unavailable).
321
322     SCHILY.devminor, SCHILY.devmajor
323             The full minor and major numbers for device nodes.
324
325     SCHILY.fflags
326             The file flags.
327
328     SCHILY.realsize
329             The full size of the file on disk.  XXX explain? XXX
330
331     SCHILY.dev, SCHILY.ino, SCHILY.nlinks
332             The device number, inode number, and link count for the entry.
333             In particular, note that a pax interchange format archive using
334             Joerg Schilling's SCHILY.* extensions can store all of the data
335             from struct stat.
336
337     LIBARCHIVE.*
338             Vendor-specific attributes used by the libarchive library and
339             programs that use it.
340
341     LIBARCHIVE.creationtime
342             The time when the file was created.  (This should not be confused
343             with the POSIX “ctime” attribute, which refers to the time when
344             the file metadata was last changed.)
345
346     LIBARCHIVE.xattr.namespace.key
347             Libarchive stores POSIX.1e-style extended attributes using keys
348             of this form.  The key value is URL-encoded: All non-ASCII char‐
349             acters and the two special characters “=” and “%” are encoded as
350             “%” followed by two uppercase hexadecimal digits.  The value of
351             this key is the extended attribute value encoded in base 64.  XXX
352             Detail the base-64 format here XXX
353
354     VENDOR.*
355             XXX document other vendor-specific extensions XXX
356
357     Any values stored in an extended attribute override the corresponding
358     values in the regular tar header.  Note that compliant readers should
359     ignore the regular fields when they are overridden.  This is important,
360     as existing archivers are known to store non-compliant values in the
361     standard header fields in this situation.  There are no limits on length
362     for any of these fields.  In particular, numeric fields can be arbitrar‐
363     ily large.  All text fields are encoded in UTF8.  Compliant writers
364     should store only portable 7-bit ASCII characters in the standard ustar
365     header and use extended attributes whenever a text value contains non-
366     ASCII characters.
367
368     In addition to the x entry described above, the pax interchange format
369     also supports a g entry.  The g entry is identical in format, but speci‐
370     fies attributes that serve as defaults for all subsequent archive
371     entries.  The g entry is not widely used.
372
373     Besides the new x and g entries, the pax interchange format has a few
374     other minor variations from the earlier ustar format.  The most troubling
375     one is that hardlinks are permitted to have data following them.  This
376     allows readers to restore any hardlink to a file without having to rewind
377     the archive to find an earlier entry.  However, it creates complications
378     for robust readers, as it is no longer clear whether or not they should
379     ignore the size field for hardlink entries.
380
381   GNU Tar Archives
382     The GNU tar program started with a pre-POSIX format similar to that
383     described earlier and has extended it using several different mechanisms:
384     It added new fields to the empty space in the header (some of which was
385     later used by POSIX for conflicting purposes); it allowed the header to
386     be continued over multiple records; and it defined new entries that mod‐
387     ify following entries (similar in principle to the x entry described
388     above, but each GNU special entry is single-purpose, unlike the general-
389     purpose x entry).  As a result, GNU tar archives are not POSIX compati‐
390     ble, although more lenient POSIX-compliant readers can successfully
391     extract most GNU tar archives.
392
393           struct header_gnu_tar {
394                   char name[100];
395                   char mode[8];
396                   char uid[8];
397                   char gid[8];
398                   char size[12];
399                   char mtime[12];
400                   char checksum[8];
401                   char typeflag[1];
402                   char linkname[100];
403                   char magic[6];
404                   char version[2];
405                   char uname[32];
406                   char gname[32];
407                   char devmajor[8];
408                   char devminor[8];
409                   char atime[12];
410                   char ctime[12];
411                   char offset[12];
412                   char longnames[4];
413                   char unused[1];
414                   struct {
415                           char offset[12];
416                           char numbytes[12];
417                   } sparse[4];
418                   char isextended[1];
419                   char realsize[12];
420                   char pad[17];
421           };
422
423     typeflag
424             GNU tar uses the following special entry types, in addition to
425             those defined by POSIX:
426
427             7       GNU tar treats type "7" records identically to type "0"
428                     records, except on one obscure RTOS where they are used
429                     to indicate the pre-allocation of a contiguous file on
430                     disk.
431
432             D       This indicates a directory entry.  Unlike the POSIX-stan‐
433                     dard "5" typeflag, the header is followed by data records
434                     listing the names of files in this directory.  Each name
435                     is preceded by an ASCII "Y" if the file is stored in this
436                     archive or "N" if the file is not stored in this archive.
437                     Each name is terminated with a null, and an extra null
438                     marks the end of the name list.  The purpose of this
439                     entry is to support incremental backups; a program
440                     restoring from such an archive may wish to delete files
441                     on disk that did not exist in the directory when the ar‐
442                     chive was made.
443
444                     Note that the "D" typeflag specifically violates POSIX,
445                     which requires that unrecognized typeflags be restored as
446                     normal files.  In this case, restoring the "D" entry as a
447                     file could interfere with subsequent creation of the
448                     like-named directory.
449
450             K       The data for this entry is a long linkname for the fol‐
451                     lowing regular entry.
452
453             L       The data for this entry is a long pathname for the fol‐
454                     lowing regular entry.
455
456             M       This is a continuation of the last file on the previous
457                     volume.  GNU multi-volume archives guarantee that each
458                     volume begins with a valid entry header.  To ensure this,
459                     a file may be split, with part stored at the end of one
460                     volume, and part stored at the beginning of the next vol‐
461                     ume.  The "M" typeflag indicates that this entry contin‐
462                     ues an existing file.  Such entries can only occur as the
463                     first or second entry in an archive (the latter only if
464                     the first entry is a volume label).  The size field spec‐
465                     ifies the size of this entry.  The offset field at bytes
466                     369-380 specifies the offset where this file fragment
467                     begins.  The realsize field specifies the total size of
468                     the file (which must equal size plus offset).  When
469                     extracting, GNU tar checks that the header file name is
470                     the one it is expecting, that the header offset is in the
471                     correct sequence, and that the sum of offset and size is
472                     equal to realsize.
473
474             N       Type "N" records are no longer generated by GNU tar.
475                     They contained a list of files to be renamed or symlinked
476                     after extraction; this was originally used to support
477                     long names.  The contents of this record are a text
478                     description of the operations to be done, in the form
479                     “Rename %s to %s\n” or “Symlink %s to %s\n”; in either
480                     case, both filenames are escaped using K&R C syntax.  Due
481                     to security concerns, "N" records are now generally
482                     ignored when reading archives.
483
484             S       This is a “sparse” regular file.  Sparse files are stored
485                     as a series of fragments.  The header contains a list of
486                     fragment offset/length pairs.  If more than four such
487                     entries are required, the header is extended as necessary
488                     with “extra” header extensions (an older format that is
489                     no longer used), or “sparse” extensions.
490
491             V       The name field should be interpreted as a tape/volume
492                     header name.  This entry should generally be ignored on
493                     extraction.
494
495     magic   The magic field holds the five characters “ustar” followed by a
496             space.  Note that POSIX ustar archives have a trailing null.
497
498     version
499             The version field holds a space character followed by a null.
500             Note that POSIX ustar archives use two copies of the ASCII digit
501             “0”.
502
503     atime, ctime
504             The time the file was last accessed and the time of last change
505             of file information, stored in octal as with mtime.
506
507     longnames
508             This field is apparently no longer used.
509
510     Sparse offset / numbytes
511             Each such structure specifies a single fragment of a sparse file.
512             The two fields store values as octal numbers.  The fragments are
513             each padded to a multiple of 512 bytes in the archive.  On
514             extraction, the list of fragments is collected from the header
515             (including any extension headers), and the data is then read and
516             written to the file at appropriate offsets.
517
518     isextended
519             If this is set to non-zero, the header will be followed by addi‐
520             tional “sparse header” records.  Each such record contains infor‐
521             mation about as many as 21 additional sparse blocks as shown
522             here:
523
524                   struct gnu_sparse_header {
525                           struct {
526                                   char offset[12];
527                                   char numbytes[12];
528                           } sparse[21];
529                           char    isextended[1];
530                           char    padding[7];
531                   };
532
533     realsize
534             A binary representation of the file's complete size, with a much
535             larger range than the POSIX file size.  In particular, with M
536             type files, the current entry is only a portion of the file.  In
537             that case, the POSIX size field will indicate the size of this
538             entry; the realsize field will indicate the total size of the
539             file.
540
541   GNU tar pax archives
542     GNU tar 1.14 (XXX check this XXX) and later will write pax interchange
543     format archives when you specify the --posix flag.  This format follows
544     the pax interchange format closely, using some SCHILY tags and introduc‐
545     ing new keywords to store sparse file information.  There have been three
546     iterations of the sparse file support, referred to as “0.0”, “0.1”, and
547     “1.0”.
548
549     GNU.sparse.numblocks, GNU.sparse.offset, GNU.sparse.numbytes,
550             GNU.sparse.size
551             The “0.0” format used an initial GNU.sparse.numblocks attribute
552             to indicate the number of blocks in the file, a pair of
553             GNU.sparse.offset and GNU.sparse.numbytes to indicate the offset
554             and size of each block, and a single GNU.sparse.size to indicate
555             the full size of the file.  This is not the same as the size in
556             the tar header because the latter value does not include the size
557             of any holes.  This format required that the order of attributes
558             be preserved and relied on readers accepting multiple appearances
559             of the same attribute names, which is not officially permitted by
560             the standards.
561
562     GNU.sparse.map
563             The “0.1” format used a single attribute that stored a comma-sep‐
564             arated list of decimal numbers.  Each pair of numbers indicated
565             the offset and size, respectively, of a block of data.  This does
566             not work well if the archive is extracted by an archiver that
567             does not recognize this extension, since many pax implementations
568             simply discard unrecognized attributes.
569
570     GNU.sparse.major, GNU.sparse.minor, GNU.sparse.name, GNU.sparse.realsize
571             The “1.0” format stores the sparse block map in one or more
572             512-byte blocks prepended to the file data in the entry body.
573             The pax attributes indicate the existence of this map (via the
574             GNU.sparse.major and GNU.sparse.minor fields) and the full size
575             of the file.  The GNU.sparse.name holds the true name of the
576             file.  To avoid confusion, the name stored in the regular tar
577             header is a modified name so that extraction errors will be
578             apparent to users.
579
580   Solaris Tar
581     XXX More Details Needed XXX
582
583     Solaris tar (beginning with SunOS XXX 5.7 ?? XXX) supports an “extended”
584     format that is fundamentally similar to pax interchange format, with the
585     following differences:
586     ·       Extended attributes are stored in an entry whose type is X, not
587             x, as used by pax interchange format.  The detailed format of
588             this entry appears to be the same as detailed above for the x
589             entry.
590     ·       An additional A header is used to store an ACL for the following
591             regular entry.  The body of this entry contains a seven-digit
592             octal number followed by a zero byte, followed by the textual ACL
593             description.  The octal value is the number of ACL entries plus a
594             constant that indicates the ACL type: 01000000 for POSIX.1e ACLs
595             and 03000000 for NFSv4 ACLs.
596
597   AIX Tar
598     XXX More details needed XXX
599
600     AIX Tar uses a ustar-formatted header with the type A for storing coded
601     ACL information.  Unlike the Solaris format, AIX tar writes this header
602     after the regular file body to which it applies.  The pathname in this
603     header is either NFS4 or AIXC to indicate the type of ACL stored.  The
604     actual ACL is stored in platform-specific binary format.
605
606   Mac OS X Tar
607     The tar distributed with Apple's Mac OS X stores most regular files as
608     two separate files in the tar archive.  The two files have the same name
609     except that the first one has “._” prepended to the last path element.
610     This special file stores an AppleDouble-encoded binary blob with addi‐
611     tional metadata about the second file, including ACL, extended
612     attributes, and resources.  To recreate the original file on disk, each
613     separate file can be extracted and the Mac OS X copyfile() function can
614     be used to unpack the separate metadata file and apply it to th regular
615     file.  Conversely, the same function provides a “pack” option to encode
616     the extended metadata from a file into a separate file whose contents can
617     then be put into a tar archive.
618
619     Note that the Apple extended attributes interact badly with long file‐
620     names.  Since each file is stored with the full name, a separate set of
621     extensions needs to be included in the archive for each one, doubling the
622     overhead required for files with long names.
623
624   Summary of tar type codes
625     The following list is a condensed summary of the type codes used in tar
626     header records generated by different tar implementations.  More details
627     about specific implementations can be found above:
628     NUL  Early tar programs stored a zero byte for regular files.
629     0    POSIX standard type code for a regular file.
630     1    POSIX standard type code for a hard link description.
631     2    POSIX standard type code for a symbolic link description.
632     3    POSIX standard type code for a character device node.
633     4    POSIX standard type code for a block device node.
634     5    POSIX standard type code for a directory.
635     6    POSIX standard type code for a FIFO.
636     7    POSIX reserved.
637     7    GNU tar used for pre-allocated files on some systems.
638     A    Solaris tar ACL description stored prior to a regular file header.
639     A    AIX tar ACL description stored after the file body.
640     D    GNU tar directory dump.
641     K    GNU tar long linkname for the following header.
642     L    GNU tar long pathname for the following header.
643     M    GNU tar multivolume marker, indicating the file is a continuation of
644          a file from the previous volume.
645     N    GNU tar long filename support.  Deprecated.
646     S    GNU tar sparse regular file.
647     V    GNU tar tape/volume header name.
648     X    Solaris tar general-purpose extension header.
649     g    POSIX pax interchange format global extensions.
650     x    POSIX pax interchange format per-file extensions.
651

SEE ALSO

653     ar(1), pax(1), tar(1)
654

STANDARDS

656     The tar utility is no longer a part of POSIX or the Single Unix Standard.
657     It last appeared in Version 2 of the Single UNIX Specification (“SUSv2”).
658     It has been supplanted in subsequent standards by pax(1).  The ustar for‐
659     mat is currently part of the specification for the pax(1) utility.  The
660     pax interchange file format is new with IEEE Std 1003.1-2001 (“POSIX.1”).
661

HISTORY

663     A tar command appeared in Seventh Edition Unix, which was released in
664     January, 1979.  It replaced the tp program from Fourth Edition Unix which
665     in turn replaced the tap program from First Edition Unix.  John Gilmore's
666     pdtar public-domain implementation (circa 1987) was highly influential
667     and formed the basis of GNU tar (circa 1988).  Joerg Shilling's star
668     archiver is another open-source (GPL) archiver (originally developed
669     circa 1985) which features complete support for pax interchange format.
670
671     This documentation was written as part of the libarchive and bsdtar
672     project by Tim Kientzle <kientzle@FreeBSD.org>.
673
674BSD                            December 23, 2011                           BSD
Impressum