*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->Tru64 Unix man pages -> tar (4)              
Title
Content
Arch
Section
 

tar(4)

Contents


NAME    [Toc]    [Back]

       tar, pax - Archive file format

DESCRIPTION    [Toc]    [Back]

       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 random 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:  A  Global  Extended  Header
       follows.   An  Extended Header follows.  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
       message 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 nonnull
 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    [Toc]    [Back]

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

EXAMPLES    [Toc]    [Back]

       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

SEE ALSO    [Toc]    [Back]

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

       Files: magic(4)



                                                           tar(4)
[ Back ]
 Similar pages
Name OS Title
ar HP-UX common archive file format
ar IRIX archive (library) file format
ar Tru64 Archive (library) file format
ldahread Tru64 read the archive header of a member of an archive file
ldahread IRIX read the archive header of a member of an archive file
tar HP-UX format of tar tape archive
cpio IRIX format of cpio archive
cpio HP-UX format of cpio archive
cpio Tru64 Format of cpio archive
ranlib NetBSD a.out archive (library) table-of-contents format
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service