unixdev.net


Switch to SpeakEasy.net DSL

The Modular Manual Browser

Home Page
Manual: (OSF1-V5.1-alpha)
Page:
Section:
Apropos / Subsearch:
optional field



tar(4)								       tar(4)



NAME

  tar, pax - Archive file format

DESCRIPTION

  The cpio, pax, and tar commands dump several files into one, in a medium
  suitable for transportation.	This file is often referred to as a tar	file,
  or tar tape, since it	was originally designed	to be on an archive tape.

  An archive file is a series of blocks, with each block of size TBLOCK.  A
  file on the archive is represented by	a header block which describes the
  file,	followed by zero or more blocks	which give the contents	of the file.
  At the end of	the tape are two blocks	filled with binary zeros, as an	end-
  of-file indicator.

  The blocks are grouped for physical I/O operations.  Each group of n blocks
  (where n is set by the b keyletter on	the tar	command	line, with a default
  of 20	blocks)	is written with	a single system	call.  On nine-track tapes,
  the result of	this write is a	single tape record.  The last group is always
  written at the full size, so blocks after the	two zero blocks	contain	ran-
  dom data.  On	reading, the specified or default group	size is	used for the
  first	read, but if that read returns less than a full	tape block, the
  reduced block	size is	used for further reads.

  The header block looks like:

       ____________________________________
       Field Name     Offset	   Length
       ____________________________________
       name		 0	    100
       mode	       100	      8
       uid	       108	      8
       gid	       116	      8
       size	       124	     12
       mtime	       136	     12
       chksum	       148	      8
       typeflag	       156	      1
       linkname	       157	    100
       magic	       257	      6
       version	       263	      2
       uname	       265	     32
       gname	       297	     32
       devmajor	       329	      8
       devminor	       337	      8
       prefix	       345	    155
       ____________________________________

  The name field is the	name of	the file, as specified on the command line.
  Files	dumped because they were in a directory	that was named on the command
  line have the	directory name as prefix and /filename as suffix.


  The mode field is the	file mode, with	the top	bit masked off.

  The uid and gid fields are the user id and group id numbers that own the
  file.


  The size field is the	size of	the file in bytes.  Links and symbolic links
  are dumped with this field specified as zero.

  The mtime field is the modification time of the file at the time it was
  dumped.

  The chksum field is an octal ASCII value which represents the	sum of all
  the bytes in the header block.  When calculating the checksum, the chksum
  field	is treated as if it were all blanks.

  The typeflag field identifies	the type of data following the header.	Valid
  values are:

       g    A Global Extended Header follows.

       x    An Extended	Header follows.

       0    Archive data follows.

  The Global Extended Header and Extended Header formats are only produced
  when the tar command is used with the	-E option, or the pax command is used
  with the -x xtar option.

  The linkname field is	the name of the	file that this file is linked to, if
  any.	If this	field is empty,	the file is not	linked.

  The first time a given i-node	number is dumped, it is	dumped as a regular
  file.	 Subsequently, it is dumped as a link instead.	Upon retrieval,	if a
  link entry is	retrieved but the file it was linked to	is not,	an error mes-
  sage is printed and the tape must be rescanned manually to retrieve the
  file that it is linked to.

  The magic field is the magic number for the file type	as described in	the
  magic(4) reference page.

  The version field is always 00 (zero-zero).

  The uname and	gname fields are the user name and group names that own	the
  file.

  The devmajor and devminor fields are the device major	and minor numbers as
  described in the mknod(8) reference page.

  The name, linkname, and prefix fields	are null-terminated strings, except
  when all characters in the field are non-null	characters.  The typeflag
  field	is a single character.	The other fields are zero-filled octal
  numbers in ASCII format terminated by	a null character.

  Unused fields	of the header are binary zeros (and are	included in the
  checksum).

NOTES

  The encoding of the header is	designed to be portable	across platforms.  If
  filenames are	chosen that use	characters not in the portable filename	char-
  acter	set, results are unpredictable.




EXAMPLES

  The layout of	an archive with	a Global Extended Header, two data files, and
  the end of archive is	shown here.


       _________________________________
	 ustar Header (typeflag=g)
	Global Extended	Header Data
       _________________________________
	 ustar Header (typeflag=x)
	    Extended Header Data
	 ustar Header (typeflag=0)
	      Data for File 1
       _________________________________
	 ustar Header (typeflag=0)
	      Data for File 2
       _________________________________
	 ustar Header (typeflag=0)
	      Data for File n
       _________________________________
	   Block of binary zeroes
       _________________________________
	   Block of binary zeroes
       _________________________________

RELATED	INFORMATION

  Commands: cpio(1), mknod(8), pax(1), tar(1)

  Files: magic(4)