File Formats
  • Audio
  • Video
  • Images
  • 3D & CAD
  • Documents
  • Data
  • Code
  • System
Data
  • Structured text
  • Binary serialisation
  • Databases
  • Scientific
  • Geospatial
  • Machine learning
  • Messages & calendars
  • Compression
  • Archives
  1. Home
  2. Data
  3. Archives
  4. TAR
  5. GNU extensions
.TAR
  • Overview
  • Header block
  • Type flags
  • Pax extensions
  • GNU extensions
  • End of archive

GNU extensions

Before pax existed, GNU tar solved the same problems in its own way: long names, files with holes, incremental backups and archives spread over several tapes. Its headers carry the magic ustar followed by two spaces and a NUL, and use the type flags L, K, S, D, M and V. GNU tar still reads all of these and writes them in its default format.

Long names

A name or link target too long for the header is written in an extra entry just before the real one. Its header has the name ././@LongLink, type flag L for a long name or K for a long link target, and a size equal to the length of the text plus one for a final NUL. Its data blocks hold the full text. The real header follows with a shortened name, which readers replace with the long one.

  1. 0Header name ././@LongLink, type flag L512 bytes
  2. 512Long name the full path and a NUL, padded to 512size rounded up
  3. …Entry header with the name cut short512 bytes
  4. …Entry datasize rounded up
An entry with a GNU long name in front of it.

The GNU header

The GNU header matches ustar up to byte 344. From byte 345, where ustar has prefix, it holds these fields instead:

OffsetSizeTypeNameDescription
34512octalatimeLast access time
35712octalctimeLast status change time
36912octaloffsetFor a M entry, where this part starts within the whole file
3814unusedlongnamesNever used
3851unusedunusedPadding
386964 entriessparseUp to four sparse map entries, each a 12-byte offset and a 12-byte length
4821flagisextendedNon-zero when more sparse map blocks follow the header
48312octalrealsizeThe full size of a sparse file
49517paddingpadZeros

The base-256 numbers that let a header hold large sizes and IDs also began in GNU tar.

Sparse files

A sparse file has holes: long runs of zeros that the file system does not store. An S entry stores only the parts that hold data. Its sparse map lists each part as an offset in the original file and a length, and the stored data is those parts one after another. realsize gives the size of the file once the holes are put back.

When four map entries are not enough, isextended is set and extension blocks follow the header. Each block holds 21 more entries (504 bytes), its own isextended byte at offset 504, and padding. Newer versions of GNU tar write sparse files in pax archives instead, using GNU.sparse. records in a pax header.

Other GNU entries

D dump directory
Written by incremental backups. Its data lists the names the folder held when the backup was made, each with a letter saying whether that file is in this backup, so that restoring can remove files deleted since an earlier backup.
V volume label
The first header of a labelled archive. The label is in name, and there is no data.
M continuation
The first header on a new volume of a multi-volume archive, holding the rest of a file that did not fit on the previous volume. offset says where in the file this part begins.
© 2026 fileformats.org About Contact Made by Lewpen