1 LIBARCHIVE-FORMATS(5) manual page
3 '''libarchive-formats'''
4 - archive formats supported by the libarchive library
8 library reads and writes a variety of streaming archive formats.
9 Generally speaking, all of these archive formats consist of a series of
11 Each entry stores a single file system object, such as a file, directory,
14 The following provides a brief description of each format supported
15 by libarchive, with some information about recognized extensions or
16 limitations of the current library support.
17 Note that just because a format is supported by libarchive does not
18 imply that a program that uses libarchive will support that format.
19 Applications that use libarchive specify which formats they wish
20 to support, though many programs do use libarchive convenience
21 functions to enable all supported formats.
25 library can read most tar archives.
26 It can write POSIX-standard
30 formats as well as v7 tar format and a subset of the legacy GNU tar format.
32 All tar formats store each entry in one or more 512-byte records.
33 The first record is used for file metadata, including filename,
34 timestamp, and mode information, and the file data is stored in
36 Later variants have extended this by either appropriating undefined
37 areas of the header record, extending the header to multiple records,
38 or by storing special entries that modify the interpretation of
41 <dt>'''gnutar'''</dt><dd>
44 library can read most GNU-format tar archives.
45 It currently supports the most popular GNU extensions, including
46 modern long filename and linkname support, as well as atime and ctime data.
47 The libarchive library does not support multi-volume
48 archives, nor the old GNU long filename format.
49 It can read GNU sparse file entries, including the new POSIX-based
54 library can write GNU tar format, including long filename
55 and linkname support, as well as atime and ctime data.
56 </dd><dt>'''pax'''</dt><dd>
59 library can read and write POSIX-compliant pax interchange format
61 Pax interchange format archives are an extension of the older ustar
62 format that adds a separate entry with additional attributes stored
63 as key/value pairs immediately before each regular entry.
64 The presence of these additional entries is the only difference between
65 pax interchange format and the older ustar format.
66 The extended attributes are of unlimited length and are stored
67 as UTF-8 Unicode strings.
68 Keywords defined in the standard are in all lowercase; vendors are allowed
69 to define custom keys by preceding them with the vendor name in all uppercase.
70 When writing pax archives, libarchive uses many of the SCHILY keys
71 defined by Joerg Schilling's
73 archiver and a few LIBARCHIVE keys.
74 The libarchive library can read most of the SCHILY keys
75 and most of the GNU keys introduced by GNU tar.
76 It silently ignores any keywords that it does not understand.
78 The pax interchange format converts filenames to Unicode
79 and stores them using the UTF-8 encoding.
80 Prior to libarchive 3.0, libarchive erroneously assumed
81 that the system wide-character routines natively supported
83 This caused it to mis-handle non-ASCII filenames on systems
84 that did not satisfy this assumption.
85 </dd><dt>'''restricted''' pax</dt><dd>
86 The libarchive library can also write pax archives in which it
87 attempts to suppress the extended attributes entry whenever
89 The result will be identical to a ustar archive unless the
90 extended attributes entry is required to store a long file
91 name, long linkname, extended ACL, file flags, or if any of the standard
92 ustar data (user name, group name, UID, GID, etc) cannot be fully
93 represented in the ustar header.
94 In all cases, the result can be dearchived by any program that
95 can read POSIX-compliant pax interchange format archives.
96 Programs that correctly read ustar format (see below) will also be
97 able to read this format; any extended attributes will be extracted as
98 separate files stored in
101 </dd><dt>'''ustar'''</dt><dd>
102 The libarchive library can both read and write this format.
103 This format has the following limitations:
106 Device major and minor numbers are limited to 21 bits.
107 Nodes with larger numbers will not be added to the archive.
109 Path names in the archive are limited to 255 bytes.
110 (Shorter if there is no / character in exactly the right place.)
112 Symbolic links and hard links are stored in the archive with
113 the name of the referenced file.
114 This name is limited to 100 bytes.
116 Extended attributes, file flags, and other extended
117 security information cannot be stored.
119 Archive entries are limited to 8 gigabytes in size.
121 Note that the pax interchange format has none of these restrictions.
122 The ustar format is old and widely supported.
123 It is recommended when compatibility is the primary concern.
124 </dd><dt>'''v7'''</dt><dd>
125 The libarchive library can read and write the legacy v7 tar format.
126 This format has the following limitations:
129 Only regular files, directories, and symbolic links can be archived.
130 Block and character device nodes, FIFOs, and sockets cannot be archived.
132 Path names in the archive are limited to 100 bytes.
134 Symbolic links and hard links are stored in the archive with
135 the name of the referenced file.
136 This name is limited to 100 bytes.
138 User and group information are stored as numeric IDs; there
139 is no provision for storing user or group names.
141 Extended attributes, file flags, and other extended
142 security information cannot be stored.
144 Archive entries are limited to 8 gigabytes in size.
146 Generally, users should prefer the ustar format for portability
147 as the v7 tar format is both less useful and less portable.
150 The libarchive library also reads a variety of commonly-used extensions to
151 the basic tar format.
152 These extensions are recognized automatically whenever they appear.
154 <dt>Numeric extensions.</dt><dd>
155 The POSIX standards require fixed-length numeric fields to be written with
156 some character position reserved for terminators.
157 Libarchive allows these fields to be written without terminator characters.
158 This extends the allowable range; in particular, ustar archives with this
159 extension can support entries up to 64 gigabytes in size.
160 Libarchive also recognizes base-256 values in most numeric fields.
161 This essentially removes all limitations on file size, modification time,
163 </dd><dt>Solaris extensions</dt><dd>
164 Libarchive recognizes ACL and extended attribute records written
166 Currently, libarchive only has support for old-style ACLs; the
167 newer NFSv4 ACLs are recognized but discarded.
170 The first tar program appeared in Seventh Edition Unix in 1979.
171 The first official standard for the tar file format was the
173 (Unix Standard Tar) format defined by POSIX in 1988.
174 POSIX.1-2001 extended the ustar format to create the
178 The libarchive library can read a number of common cpio variants and can write
183 A cpio archive stores each entry as a fixed-size header followed
184 by a variable-length filename and variable-length data.
185 Unlike the tar format, the cpio format does only minimal padding
186 of the header or file data.
187 There are several cpio variants, which differ primarily in
188 how they store the initial header: some store the values as
189 octal or hexadecimal numbers in ASCII, others as binary values of
190 varying byte order and length.
192 <dt>'''binary'''</dt><dd>
193 The libarchive library transparently reads both big-endian and little-endian
194 variants of the original binary cpio format.
195 This format used 32-bit binary values for file size and mtime,
196 and 16-bit binary values for the other fields.
197 </dd><dt>'''odc'''</dt><dd>
198 The libarchive library can both read and write this
199 POSIX-standard format, which is officially known as the
200 "cpio interchange format"
202 "octet-oriented cpio archive format"
203 and sometimes unofficially referred to as the
204 "old character format".
205 This format stores the header contents as octal values in ASCII.
206 It is standard, portable, and immune from byte-order confusion.
207 File sizes and mtime are limited to 33 bits (8GB file size),
208 other fields are limited to 18 bits.
209 </dd><dt>'''SVR4/newc'''</dt><dd>
210 The libarchive library can read both CRC and non-CRC variants of
212 The SVR4 format uses eight-digit hexadecimal values for
214 This limits file size to 4GB, and also limits the mtime and
215 other fields to 32 bits.
216 The SVR4 format can optionally include a CRC of the file
217 contents, although libarchive does not currently verify this CRC.
220 Cpio first appeared in PWB/UNIX 1.0, which was released within
222 PWB/UNIX 1.0 formed the basis of System III Unix, released outside
224 This makes cpio older than tar, although cpio was not included
225 in Version 7 AT&T Unix.
226 As a result, the tar command became much better known in universities
227 and research groups that used Version 7.
228 The combination of the
232 utilities provided very precise control over file selection.
233 Unfortunately, the format has many limitations that make it unsuitable
235 Only the POSIX format permits files over 4GB, and its 18-bit
236 limit for most other fields makes it unsuitable for modern systems.
237 In addition, cpio formats only store numeric UID/GID values (not
238 usernames and group names), which can make it very difficult to correctly
239 transfer archives across systems with dissimilar user numbering.
243 is a shell script that, when executed on a POSIX-compliant
244 system, will recreate a collection of file system objects.
245 The libarchive library can write two different kinds of shar archives:
247 <dt>'''shar'''</dt><dd>
248 The traditional shar format uses a limited set of POSIX
250 [[echo(1)|http://www.freebsd.org/cgi/man.cgi?query=echo&sektion=1]],
251 [[mkdir(1)|http://www.freebsd.org/cgi/man.cgi?query=mkdir&sektion=1]],
253 [[sed(1)|http://www.freebsd.org/cgi/man.cgi?query=sed&sektion=1]].
254 It is suitable for portably archiving small collections of plain text files.
255 However, it is not generally well-suited for large archives
256 (many implementations of
257 [[sh(1)|http://www.freebsd.org/cgi/man.cgi?query=sh&sektion=1]]
258 have limits on the size of a script) nor should it be used with non-text files.
259 </dd><dt>'''shardump'''</dt><dd>
260 This format is similar to shar but encodes files using
261 [[uuencode(1)|http://www.freebsd.org/cgi/man.cgi?query=uuencode&sektion=1]]
262 so that the result will be a plain text file regardless of the file contents.
263 It also includes additional shell commands that attempt to reproduce as
264 many file attributes as possible, including owner, mode, and flags.
265 The additional commands used to restore file attributes make
266 shardump archives less portable than plain shar archives.
268 === ISO9660 format===
269 Libarchive can read and extract from files containing ISO9660-compliant
271 In many cases, this can remove the need to burn a physical CDROM
272 just in order to read the files contained in an ISO9660 image.
273 It also avoids security and complexity issues that come with
274 virtual mounts and loopback devices.
275 Libarchive supports the most common Rockridge extensions and has partial
276 support for Joliet extensions.
277 If both extensions are present, the Joliet extensions will be
278 used and the Rockridge extensions will be ignored.
279 In particular, this can create problems with hardlinks and symlinks,
280 which are supported by Rockridge but not by Joliet.
282 Libarchive reads ISO9660 images using a streaming strategy.
283 This allows it to read compressed images directly
284 (decompressing on the fly) and allows it to read images
285 directly from network sockets, pipes, and other non-seekable
287 This strategy works well for optimized ISO9660 images created
288 by many popular programs.
289 Such programs collect all directory information at the beginning
290 of the ISO9660 image so it can be read from a physical disk
291 with a minimum of seeking.
292 However, not all ISO9660 images can be read in this fashion.
294 Libarchive can also write ISO9660 images.
295 Such images are fully optimized with the directory information
296 preceding all file data.
297 This is done by storing all file data to a temporary file
298 while collecting directory information in memory.
299 When the image is finished, libarchive writes out the
300 directory structure followed by the file data.
301 The location used for the temporary file can be changed
302 by the usual environment variables.
304 Libarchive can read and write zip format archives that have
305 uncompressed entries and entries compressed with the
308 Other zip compression algorithms are not supported.
309 It can extract jar archives, archives that use Zip64 extensions and
310 self-extracting zip archives.
311 Libarchive can use either of two different strategies for
312 reading Zip archives:
313 a streaming strategy which is fast and can handle extremely
314 large archives, and a seeking strategy which can correctly
315 process self-extracting Zip archives and archives with
316 deleted members or other in-place modifications.
318 The streaming reader processes Zip archives as they are read.
319 It can read archives of arbitrary size from tape or
320 network sockets, and can decode Zip archives that have
321 been separately compressed or encoded.
322 However, self-extracting Zip archives and archives with
323 certain types of modifications cannot be correctly
325 Such archives require that the reader first process the
326 Central Directory, which is ordinarily located
327 at the end of a Zip archive and is thus inaccessible
328 to the streaming reader.
329 If the program using libarchive has enabled seek support, then
330 libarchive will use this to processes the central directory first.
332 In particular, the seeking reader must be used to
333 correctly handle self-extracting archives.
334 Such archives consist of a program followed by a regular
336 The streaming reader cannot parse the initial program
337 portion, but the seeking reader starts by reading the
338 Central Directory from the end of the archive.
339 Similarly, Zip archives that have been modified in-place
340 can have deleted entries or other garbage data that
341 can only be accurately detected by first reading the
343 === Archive (library) file format===
344 The Unix archive format (commonly created by the
345 [[ar(1)|http://www.freebsd.org/cgi/man.cgi?query=ar&sektion=1]]
346 archiver) is a general-purpose format which is
347 used almost exclusively for object files to be
348 read by the link editor
349 [[ld(1)|http://www.freebsd.org/cgi/man.cgi?query=ld&sektion=1]].
350 The ar format has never been standardised.
351 There are two common variants:
352 the GNU format derived from SVR4,
353 and the BSD format, which first appeared in 4.4BSD.
354 The two differ primarily in their handling of filenames
355 longer than 15 characters:
356 the GNU/SVR4 variant writes a filename table at the beginning of the archive;
357 the BSD format stores each long filename in an extension
358 area adjacent to the entry.
359 Libarchive can read both extensions,
360 including archives that may include both types of long filenames.
361 Programs using libarchive can write GNU/SVR4 format
362 if they provide an entry called
364 containing a filename table to be written into the archive
365 before any of the entries.
366 Any entries whose names are not in the filename table
367 will be written using BSD-style long filenames.
368 This can cause problems for programs such as
369 GNU ld that do not support the BSD-style long filenames.
371 Libarchive can read and write files in
374 This format is not a true archive format, but rather a textual description
375 of a file hierarchy in which each line specifies the name of a file and
376 provides specific metadata about that file.
377 Libarchive can read all of the keywords supported by both
378 the NetBSD and FreeBSD versions of
379 [[mtree(8)|http://www.freebsd.org/cgi/man.cgi?query=mtree&sektion=8]],
380 although many of the keywords cannot currently be stored in an
383 When writing, libarchive supports use of the
384 [[ManPagerchiveriteetptions3]]
385 interface to specify which keywords should be included in the
387 If libarchive was compiled with access to suitable
388 cryptographic libraries (such as the OpenSSL libraries),
389 it can compute hash entries such as
393 from file data being written to the mtree writer.
395 When reading an mtree file, libarchive will locate the corresponding
396 files on disk using the
398 keyword if present or the regular filename.
399 If it can locate and open the file on disk, it will use that
400 to fill in any metadata that is missing from the mtree file
401 and will read the file contents and return those to the program
403 If it cannot locate and open the file on disk, libarchive
404 will return an error for any attempt to read the entry
407 Libarchive can read and write 7-Zip format archives.
408 TODO: Need more information
410 Libarchive can read Microsoft Cabinet (
413 TODO: Need more information.
415 TODO: Information about libarchive's LHA support
417 Libarchive has limited support for reading RAR format archives.
418 Currently, libarchive can read RARv3 format archives
419 which have been either created uncompressed, or compressed using
420 any of the compression methods supported by the RARv3 format.
421 Libarchive can also read self-extracting RAR archives.
423 Libarchive can read and write
425 TODO: Need more information
427 Libarchive can read and write the XAR format used by many Apple tools.
428 TODO: Need more information
430 [[ar(1)|http://www.freebsd.org/cgi/man.cgi?query=ar&sektion=1]],
432 [[mkisofs(1)|http://www.freebsd.org/cgi/man.cgi?query=mkisofs&sektion=1]],
433 [[shar(1)|http://www.freebsd.org/cgi/man.cgi?query=shar&sektion=1]],
435 [[zip(1)|http://www.freebsd.org/cgi/man.cgi?query=zip&sektion=1]],
436 [[zlib(3)|http://www.freebsd.org/cgi/man.cgi?query=zlib&sektion=3]],