home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / tar-1.11.8-bin.lha / info / tar.info-5 (.txt) < prev    next >
GNU Info File  |  1996-10-12  |  50KB  |  893 lines

  1. This is Info file tar.info, produced by Makeinfo-1.64 from the input
  2. file /ade-src/fsf/tar/doc/tar.texinfo.
  3. START-INFO-DIR-ENTRY
  4. * tar: (tar).            Making tape (or disk) archives.
  5. END-INFO-DIR-ENTRY
  6.    This file documents GNU `tar', a utility used to store, backup, and
  7. transport files.
  8.    Copyright (C) 1992, 1994, 1995 Free Software Foundation, Inc.
  9.    Permission is granted to make and distribute verbatim copies of this
  10. manual provided the copyright notice and this permission notice are
  11. preserved on all copies.
  12.    Permission is granted to copy and distribute modified versions of
  13. this manual under the conditions for verbatim copying, provided that
  14. the entire resulting derived work is distributed under the terms of a
  15. permission notice identical to this one.
  16.    Permission is granted to copy and distribute translations of this
  17. manual into another language, under the above conditions for modified
  18. versions, except that this permission notice may be stated in a
  19. translation approved by the Foundation.
  20. File: tar.info,  Node: Checksumming Problems,  Prev: Old V7 and POSIX,  Up: Portability
  21. Checksumming Problems
  22. ---------------------
  23.    SunOS and HP-UX `tar' fail to accept archives created using GNU
  24. `tar' and containing non-ASCII file names, because they use signed
  25. checksums, while GNU `tar' uses unsigned checksums while creating
  26. archives, as per POSIX standards.  On reading, GNU `tar' computes both
  27. checksums and accept any.  It is somewhat worrying that a lot of people
  28. may go around doing backup of their files using faulty (or at least
  29. non-standard) software, not learning about it until it's time to
  30. restore their missing files with an incompatible file extractor, or vice
  31. versa.
  32.    GNU `tar' is supposed to compute both checksums, signed and
  33. unsigned, and accept any.  However, 1.11.2 has a bug by which signed
  34. checksums are incorrectly initialized, so they do not work.  This is
  35. corrected in the subsequent GNU `tar' versions.  However, GNU `tar' has
  36. not been modified to *produce* incorrect archives to be read by buggy
  37. `tar''s.
  38.    I've been told that when Sun first imported `tar' on their system,
  39. they recompiled it without realizing that the checksums were computed
  40. differently, because of a change in the default signing of `char''s in
  41. their compiler.  So they started computing checksums wrongly, and
  42. stayed compatible with themselves afterwards.  It now falls on the
  43. shoulders of SunOS and HP-UX users to get a `tar' able to read the good
  44. archives they receive.
  45. File: tar.info,  Node: Write Protection,  Prev: Portability,  Up: Being Careful
  46. Write Protection
  47. ================
  48.    All tapes and disks can be "write protected", to protect data on
  49. them from being changed.  Once an archive is written, you should write
  50. protect the media to prevent the archive from being accidently
  51. overwritten or deleted.  (This will protect the archive from being
  52. changed with a tape or floppy drive--it will not protect it from magnet
  53. fields or other physical hazards).
  54.    The write protection device itself is usually an integral part of the
  55. physical media, and can be a two position (write enabled/write
  56. disabled) switch, a notch which can be popped out or covered, a ring
  57. which can be removed from the center of a tape reel, or some other
  58. changeable feature.
  59. File: tar.info,  Node: Format Control,  Next: Media,  Prev: Being Careful,  Up: Top
  60. Controlling the Archive Format
  61. ******************************
  62. * Menu:
  63. * Attributes Options::
  64. * Type Options::
  65. * Compression::
  66. * Special Options for Archiving::
  67. * Archive Structure::
  68. * Modifiers Options::
  69. File: tar.info,  Node: Attributes Options,  Next: Type Options,  Prev: Format Control,  Up: Format Control
  70. Handling of file attributes
  71. ===========================
  72.      *(This message will disappear, once this node revised.)*
  73.    Handling of file attributes
  74. `--atime-preserve'
  75.      Do not change access times on dumped files.
  76. `--modification-time'
  77.      Do not extract file modified time.
  78.      When this option is used, `tar' leaves the modification times of
  79.      the files it extracts as the time when the files were extracted,
  80.      instead of setting it to the time recorded in the archive.
  81.      This option is meaningless with `--list' (`-t').
  82. `--same-owner'
  83.      Create extracted files with the same ownership.
  84. `--same-permissions'
  85. `--preserve-permissions'
  86.      Extract all protection information.
  87.      This option causes `tar' to set the modes (access permissions) of
  88.      extracted files exactly as recorded in the archive.  If this option
  89.      is not used, the current `umask' setting limits the permissions on
  90.      extracted files.
  91.      This option is meaningless with `--list' (`-t').
  92. `--same-order'
  93. `--preserve-order'
  94.      Sort names to extract to match archive.
  95.      This option tells `tar' that the list of file names to be listed
  96.      or extracted is sorted in the same order as the files in the
  97.      archive.  This allows a large list of names to be used, even on a
  98.      small machine that would not otherwise be able to hold all the
  99.      names in memory at the same time.  Such a sorted list can easily
  100.      be created by running `tar -t' on the archive and editing its
  101.      output.
  102.      This option is probably never needed on modern computer systems.
  103. `--preserve'
  104.      Same as both `--same-permissions' (`-p') and `--same-order' (`-s').
  105.      The `--preserve' option has no equivalent short option name.  It
  106.      is equivalent to `--same-permissions' (`-p') plus `--same-order'
  107.      (`-s').
  108. File: tar.info,  Node: Type Options,  Next: Compression,  Prev: Attributes Options,  Up: Format Control
  109. Archive format selection
  110. ========================
  111.      *(This message will disappear, once this node revised.)*
  112.    Archive format selection
  113. `-V NAME'
  114. `--label=NAME'
  115.      Create archive with volume name NAME.
  116.      This option causes `tar' to write out a "volume header" at the
  117.      beginning of the archive.  If `--multi-volume' (`-M') is used, each
  118.      volume of the archive will have a volume header of `NAME Volume
  119.      N', where N is 1 for the first volume, 2 for the next, and so on.
  120. `--gzip'
  121. `--ungzip'
  122.      Filter the archive through `gzip'.
  123.      This option works on physical devices (tape drives, etc.) and
  124.      remote files as well as on normal files; data to or from such
  125.      devices or remote files is reblocked by another copy of the `tar'
  126.      program to enforce the specified (or default) block size.  The
  127.      default compression parameters are used; if you need to override
  128.      them, avoid the `--gzip' (`-z') option and run `gzip' explicitly.
  129.      (Or set the `GZIP' environment variable.)
  130.      If the `--gzip' (`-z') option is given twice, or the
  131.      `--compress-blocks' option is used, `tar' will pad the archive out
  132.      to the next block boundary (
  133.      FIXME: pxref Blocking
  134.      ).  This may be useful with some devices that require that all
  135.      write operations be a multiple of a certain size.
  136.      The `--gzip' (`-z') option does not work with the `--multi-volume'
  137.      (`-M') option, or with the `--update' (`-u'), `--append' (`-r'),
  138.      `--concatenate' (`-A'), or `--delete' commands.
  139.      It is not exact to say that GNU `tar' is to work in concert with
  140.      `gzip' in a way similar to `zip', say.  Surely, it is possible
  141.      that `tar' and `gzip' be done with a single call, like in:
  142.           tar cfz archive.tar.gz subdir
  143.      to save all of `subdir' into a `gzip''ed archive.  Later you can
  144.      do:
  145.           tar xfz archive.tar.gz
  146.      to explode and unpack.
  147.      The difference is that the whole archive is compressed.  With
  148.      `zip', archive members are archived individually.  `tar''s method
  149.      yields better compression.  On the other hand, one can view the
  150.      contents of a `zip' archive without having to decompress it.  As
  151.      for the `tar' and `gzip' tandem, you need to decompress the
  152.      archive to see its contents.  However, this may be done without
  153.      needing disk space, by using pipes internally:
  154.           tar tfz archive.tar.gz
  155.      About corrupted compressed archives: `gzip''ed files have no
  156.      redundancy, for maximum compression.  The adaptive nature of the
  157.      compression scheme means that the compression tables are implicitly
  158.      spread all over the archive.  If you lose a few blocks, the dynamic
  159.      construction of the compression tables becomes unsychronized, and
  160.      there is little chance that you could recover later in the archive.
  161.      There are pending suggestions for having a per-volume or per-file
  162.      compression in GNU `tar'.  This would allow for viewing the
  163.      contents without decompression, and for resynchronizing
  164.      decompression at every volume or file, in case of corrupted
  165.      archives.  Doing so, we might loose some compressibility.  But
  166.      this would have make recovering easier.  So, there are pros and
  167.      cons.  We'll see!
  168. `--compress'
  169. `--uncompress'
  170.      Filter the archive through `compress'.  Otherwise like `--gzip'
  171.      (`-z').
  172. `--use-compress-program=PROG'
  173.      Filter through PROG (must accept `-d').
  174. File: tar.info,  Node: Compression,  Next: Special Options for Archiving,  Prev: Type Options,  Up: Format Control
  175. Using Less Space through Compression
  176. ====================================
  177. * Menu:
  178. * Compressed Archives::
  179. * Dealing with Compressed Archives::
  180. * Sparse Files::
  181. File: tar.info,  Node: Compressed Archives,  Next: Dealing with Compressed Archives,  Prev: Compression,  Up: Compression
  182. Creating and Reading Compressed Archives
  183. ----------------------------------------
  184.      *(This message will disappear, once this node revised.)*
  185.    `--compress' (`-Z') indicates an archive stored in compressed format.
  186. The `--compress' (`-Z') option is useful in saving time over networks
  187. and space in pipes, and when storage space is at a premium.
  188. `--compress' (`-Z') causes `tar' to compress when writing the archive,
  189. or to uncompress when reading the archive.
  190.    To perform compression and uncompression on the archive, `tar' runs
  191. the `compress' utility.  `tar' uses the default compression parameters;
  192. if you need to override them, avoid the `--compress' (`-Z') option and
  193. run the `compress' utility explicitly.  It is useful to be able to call
  194. the `compress' utility from within `tar' because the `compress' utility
  195. by itself cannot access remote tape drives.
  196.    The `--compress' (`-Z') option will not work in conjunction with the
  197. `--multi-volume' (`-M') option or the `--append' (`-r'), `--update'
  198. (`-u'), `--append' (`-r') and `--delete' operations.
  199. FIXME: xref Modifying
  200.    , for more information on these operations.
  201.    If there is no compress utility available, `tar' will report an
  202. error.
  203.    `--compress-blocks' is like `--compress' (`-Z'), but when used in
  204. conjunction with `--create' (`-c') also causes `tar' to pad the last
  205. block of the archive out to the next block boundary as it is written.
  206. This is useful with certain devices which require all write operations
  207. be a multiple of a specific size.
  208.      *Please Note:* The `compress' program may be covered by a patent,
  209.      and therefore we recommend you stop using it.  We hope to have a
  210.      different compress program in the future.  We may change the name
  211.      of this option at that time.
  212. `--compress'
  213. `--uncompress'
  214.      When this option is specified, `tar' will compress (when writing
  215.      an archive), or uncompress (when reading an archive).  Used in
  216.      conjunction with the `--create' (`-c'), `--extract' (`-x'),
  217.      `--list' (`-t') and `--compare' (`-d') operations.
  218. `--compress-block'
  219. `-z -z'
  220.      Acts like `--compress' (`-Z'), but pads the archive out to the
  221.      next block boundary as it is written when used in conjunction with
  222.      the `--create' (`-c') operation.
  223. FIXME: why not use -Z instead of -z -z ?
  224. File: tar.info,  Node: Dealing with Compressed Archives,  Next: Sparse Files,  Prev: Compressed Archives,  Up: Compression
  225. Dealing with Compressed Archives
  226. --------------------------------
  227.      *(This message will disappear, once this node revised.)*
  228.    You can have archives be compressed by using the `--gzip' (`-z')
  229. option.  This will arrange for `tar' to use the `gzip' program to be
  230. used to compress or uncompress the archive wren writing or reading it.
  231.    To use the older, obsolete, `compress' program, use the `--compress'
  232. (`-Z') option.  The GNU Project recommends you not use `compress',
  233. because there is a patent covering the algorithm it uses.  Merely by
  234. running `compress' you could be sued for patent infringment.
  235.    When using either `--gzip' (`-z') or `--compress' (`-Z'), `tar' does
  236. not do blocking (
  237. FIXME: pxref Blocking
  238.    ) correctly.  Use `--gzip-block' or `--compress-blocks' instead when
  239. using real tape drives.
  240. File: tar.info,  Node: Sparse Files,  Prev: Dealing with Compressed Archives,  Up: Compression
  241. Archiving Sparse Files
  242. ----------------------
  243.      *(This message will disappear, once this node revised.)*
  244.    A file is sparse if it contains blocks of zeros whose existance is
  245. recorded, but that have no space allocated on disk.  When you specify
  246. the `--sparse' (`-S') option in conjunction with the `--create' (`-c')
  247. operation, `tar' tests all files for sparseness while archiving.  If
  248. `tar' finds a file to be sparse, it uses a sparse representation of the
  249. file in the archive.
  250. FIXME: xref Creating Archives
  251.    , for more information about creating archives.
  252.    `--sparse' (`-S') is useful when archiving files, such as dbm files,
  253. likely to contain many nulls.  This option dramatically decreases the
  254. amount of space needed to store such an archive.
  255.      *Please Note:* Always use `--sparse' (`-S') when performing file
  256.      system backups, to avoid archiving the expanded forms of files
  257.      stored sparsely in the system.
  258.      Even if your system has no no sparse files currently, some may be
  259.      created in the future.  If you use `--sparse' (`-S') while making
  260.      file system backups as a matter of course, you can be assured the
  261.      archive will always take no more space on the media than the files
  262.      take on disk (otherwise, archiving a disk filled with sparse files
  263.      might take hundreds of tapes).
  264.      FIXME: xref incremental when node name is set.
  265.    `tar' ignores the `--sparse' (`-S') option when reading an archive.
  266. `--sparse'
  267.      Files stored sparsely in the file system are represented sparsely
  268.      in the archive.  Use in conjunction with write operations.
  269. File: tar.info,  Node: Special Options for Archiving,  Next: Archive Structure,  Prev: Compression,  Up: Format Control
  270. Special Options for Archiving
  271. =============================
  272.      *(This message will disappear, once this node revised.)*
  273.    To give the archive a name which will be recorded in it, use the
  274. `--label=ARCHIVE-LABEL' (`-V ARCHIVE-LABEL') option.  This will write a
  275. special record identifying VOLUME-LABEL as the name of the archive to
  276. the front of the archive which will be displayed when the archive is
  277. listed with `--list' (`-t').  If you are creating a multi-volume
  278. archive with `--multi-volume' (`-M') (
  279. FIXME: pxref Using Multiple Tapes
  280.    ), then the volume label will have `Volume NNN' appended to the name
  281. you give, where NNN is the number of the volume of the archive.  (If
  282. you use the `--label=ARCHIVE-LABEL' (`-V ARCHIVE-LABEL') option when
  283. reading an archive, it checks to make sure the label on the tape
  284. matches the one you give.
  285. FIXME: xref Special Options for Archiving
  286.    .)
  287.    Files in the filesystem occasionally have "holes."  A hole in a file
  288. is a section of the file's contents which was never written.  The
  289. contents of a hole read as all zeros.  On many operating systems,
  290. actualdisk storage is not allocated for holes, but they are counted in
  291. the length of the file.  If you archive such a file, `tar' could create
  292. an archive longer than the original.  To have `tar' attempt to
  293. recognize the holes in a file, use `--sparse' (`-S').  When you use the
  294. `--sparse' (`-S') option, then, for any file using less disk space than
  295. would be expected from its length, `tar' searches the file for
  296. consecutive stretches of zeros.  It then records in the archive for the
  297. file where the consecutive stretches of zeros are, and only archives the
  298. "real contents" of the file.  On extraction (using `--sparse' (`-S') is
  299. not needed on extraction) any such files have hols created wherever the
  300. continuous stretches of zeros were found.  Thus, if you use `--sparse'
  301. (`-S'), `tar' archives won't take more space than the original.
  302.    When `tar' reads files, this causes them to have the access times
  303. updated.  To have `tar' attempt to set the access times back to what
  304. they were before they were read, use the `--atime-preserve' option.
  305. This doesn't work for files that you don't own, unless you're root, and
  306. it doesn't interact with incremental dumps nicely (
  307. FIXME: pxref Making Backups
  308.    ), but it is good enough for some purposes.
  309. File: tar.info,  Node: Archive Structure,  Next: Modifiers Options,  Prev: Special Options for Archiving,  Up: Format Control
  310. The Structure of an Archive
  311. ===========================
  312.      *(This message will disappear, once this node revised.)*
  313.    While an archive may contain many files, the archive itself is a
  314. single ordinary file.  Like any other file, an archive file can be
  315. written to a storage device such as a tape or disk, sent through a pipe
  316. or over a network, saved on the active file system, or even stored in
  317. another archive.  An archive file is not easy to read or manipulate
  318. without using the `tar' utility or Tar mode in Emacs.
  319.    Physically, an archive consists of a series of file entries
  320. terminated by an end-of-archive entry, which consists of 512 zero
  321. bytes.  A file entry usually describes one of the files in the archive
  322. (an "archive member"), and consists of a file header and the contents
  323. of the file.  File headers contain file names and statistics, checksum
  324. information which `tar' uses to detect file corruption, and information
  325. about file types.
  326.    More than archive member can have the same file name.  One way this
  327. situation can occur is if more than one version of a file has been
  328. stored in the archive.  For information about adding new versions of a
  329. file to an archive,
  330. FIXME: pxref Modifying
  331.    In addition to entries describing archive members, an archive may
  332. contain entries which `tar' itself uses to store information.
  333. FIXME: xref Archive Label
  334.    , for an example of such an archive entry.
  335. File: tar.info,  Node: Modifiers Options,  Prev: Archive Structure,  Up: Format Control
  336. Operation mode modifiers
  337. ========================
  338.      *(This message will disappear, once this node revised.)*
  339.    Operation mode modifiers
  340. `--verify'
  341.      Attempt to verify the archive after writing.
  342.      This option causes `tar' to verify the archive after writing it.
  343.      Each volume is checked after it is written, and any discrepancies
  344.      are recorded on the standard error output.
  345.      Verification requires that the archive be on a back-space-able
  346.      medium.  This means pipes, some cartridge tape drives, and some
  347.      other devices cannot be verified.
  348. `--remove-files'
  349.      Remove files after adding them to the archive.
  350. `--keep-old-files'
  351.      Do not overwrite existing files from archive.
  352.      The `--keep-old-files' (`-k') option prevents `tar' from
  353.      over-writing existing files with files with the same name from the
  354.      archive.
  355.      The `--keep-old-files' (`-k') option is meaningless with `--list'
  356.      (`-t').
  357. `--sparse'
  358.      Handle sparse files efficiently.
  359.      This option causes all files to be put in the archive to be tested
  360.      for sparseness, and handled specially if they are.  The `--sparse'
  361.      (`-S') option is useful when many `dbm' files, for example, are
  362.      being backed up.  Using this option dramatically decreases the
  363.      amount of space needed to store such a file.
  364.      In later versions, this option may be removed, and the testing and
  365.      treatment of sparse files may be done automatically with any
  366.      special GNU options.  For now, it is an option needing to be
  367.      specified on the command line with the creation or updating of an
  368.      archive.
  369. `--to-stdout'
  370.      Extract files to standard output.
  371.      When this option is used, instead of creating the files specified,
  372.      `tar' writes the contents of the files extracted to its standard
  373.      output.  This may be useful if you are only extracting the files in
  374.      order to send them through a pipe.
  375.      This option is meaningless with `--list' (`-t').
  376. `--ignore-failed-read'
  377.      Do not exit with non-zero on unreadable files.
  378. FIXME: This section needs to be written
  379.    *To come:* using Unix file linking capability to recreate directory
  380. structures--linking files into one subdirectory and then `tar'ring that
  381. directory.
  382.    *to come:* nice hairy example using absolute-names, newer, etc.
  383.    Piping one `tar' to another is an easy way to copy a directory's
  384. contents from one disk to another, while preserving the dates, modes,
  385. owners and link-structure of all the files therein.
  386.      cd sourcedirectory; tar cf - . | (cd targetdir; tar xf -)
  387. FIXME: the following using standard input/output correct??
  388.      cd sourcedirectory; tar --create --file=- . | (cd targetdir; tar --extract --file=-)
  389. Archive files can be used for transporting a group of files from one
  390. system to another:  put all relevant files into an archive on one
  391. computer system, transfer the archive to another, and extract the
  392. contents there. The basic transfer medium might be magnetic tape,
  393. Internet FTP, or even electronic mail (though you must encode the
  394. archive with `uuencode' in order to transport it properly by mail).
  395. Both machines do not have to use the same operating system, as long as
  396. they both support the `tar' program.
  397. FIXME: mention uuencode on a paragraph of its own
  398. FIXME: end construction
  399. File: tar.info,  Node: Media,  Next: Backups and Restoration,  Prev: Format Control,  Up: Top
  400. Tapes and Other Archive Media
  401. *****************************
  402.      *(This message will disappear, once this node revised.)*
  403.    A few special cases about tape handling warrant more detailed
  404. description.  These special cases are discussed below.
  405.    Many complexities surround the use of `tar' on tape drives.  Since
  406. the creation and manipulation of archives located on magnetic tape was
  407. the original purpose of `tar', it contains many features making such
  408. manipulation easier.
  409.    Archives are usually written on dismountable media--tape cartridges,
  410. mag tapes, or floppy disks.
  411.    The amount of data a tape or disk holds depends not only on its size,
  412. but also on how it is formatted.  A 2400 foot long reel of mag tape
  413. holds 40 megabytes of data when formated at 1600 bits per inch.  The
  414. physically smaller EXABYTE tape cartridge holds 2.3 gigabytes.
  415.    Magnetic media are re-usable--once the archive on a tape is no longer
  416. needed, the archive can be erased and the tape or disk used over.
  417. Media quality does deteriorate with use, however.  Most tapes or disks
  418. should be disgarded when they begin to produce data errors.  EXABYTE
  419. tape cartridges should be disgarded when they generate an "error count"
  420. (number of non-usable bits) of more than 10k.
  421.    Magnetic media are written and erased using magnetic fields, and
  422. should be protected from such fields to avoid damage to stored data.
  423. Sticking a floppy disk to a filing cabinet using a magnet is probably
  424. not a good idea.
  425. * Menu:
  426. * Device::
  427. * Blocking::
  428. * Many::
  429. * Using Multiple Tapes::
  430. * Archive Label::
  431. File: tar.info,  Node: Device,  Next: Blocking,  Prev: Media,  Up: Media
  432. Device selection and switching
  433. ==============================
  434.      *(This message will disappear, once this node revised.)*
  435. `-f [HOSTNAME:]FILE'
  436. `--file=[HOSTNAME:]FILE'
  437.      Use archive file or device FILE on HOSTNAME.
  438.      This option is used to specify the file name of the archive `tar'
  439.      works on.
  440.      If the file name is `-', `tar' reads the archive from standard
  441.      input (when listing or extracting), or writes it to standard output
  442.      (when creating).  If the `-' file name is given when updating an
  443.      archive, `tar' will read the original archive from its standard
  444.      input, and will write the entire new archive to its standard
  445.      output.
  446.      If the file name contains a `:', it is interpreted as
  447.      `hostname:filename'.  If the HOSTNAME contains an "at" sign (`@'),
  448.      it is treated as `user@hostname:filename'.  In either case, `tar'
  449.      will invoke the command `rsh' (or `remsh') to start up an
  450.      `/etc/rmt' on the remote machine.  If you give an alternate login
  451.      name, it will be given to the `rsh'.  Naturally, the remote
  452.      machine must have an executable `/etc/rmt'.  This program is free
  453.      software from the University of California, and a copy of the
  454.      source code can be found with the sources for `tar'; it's compiled
  455.      and installed by default.
  456.      If this option is not given, but the environment variable `TAPE' is
  457.      set, its value is used; otherwise, old versions of `tar' used a
  458.      default archive name (which was picked when `tar' was compiled).
  459.      The default is normally set up to be the "first" tape drive or
  460.      other transportable I/O medium on the system.
  461.      Starting with version 1.11.5, GNU `tar' uses standard input and
  462.      standard output as the default device, and I will not try anymore
  463.      supporting automatic device detection at installation time.  This
  464.      was failing really in too many cases, it was hopeless.  This is now
  465.      completely left to the installer to override standard input and
  466.      standard output for default device, if this seems preferrable to
  467.      him/her.  Further, I think *most* actual usages of `tar' are done
  468.      with pipes or disks, not really tapes, cartridges or diskettes.
  469.      Some users think that using standard input and output is running
  470.      after trouble.  This could lead to a nasty surprise on your screen
  471.      if you forget to specify an output file name--especially if you
  472.      are going through a network or terminal server capable of
  473.      buffering large amounts of output.  We had so many bug reports in
  474.      that area of configuring default tapes automatically, and so many
  475.      contradicting requests, that we finally consider the problem to be
  476.      portably intractable.  We could of course use something like
  477.      `/dev/tape' as a default, but this is *also* running after various
  478.      kind of trouble, going from hung processes to accidental
  479.      destruction of real tapes.  After having seen all this mess, using
  480.      standard input and output as a default really sounds like the only
  481.      clean choice left, and a very useful one too.
  482.      GNU `tar' reads and writes archive in blocks, I suspect this is the
  483.      main reason why block devices are preferred over character devices.
  484.      Most probably, block devices are more efficient too.  The installer
  485.      could also check for `DEFTAPE' in `<sys/mtio.h>'.
  486. `--force-local'
  487.      Archive file is local even if it contains a colon.
  488. `--rsh-command=COMMAND'
  489.      Use remote COMMAND instead of `rsh'.  This option exists so that
  490.      people who use something other than the standard `rsh' (e.g., a
  491.      Kerberized `rsh') can access a remote device.
  492.      When this command is not used, the shell command found when the
  493.      `tar' program was installed is used instead.  This is the first
  494.      found of `/usr/ucb/rsh', `/usr/bin/remsh', `/usr/bin/rsh',
  495.      `/usr/bsd/rsh' or `/usr/bin/nsh'.  The installer may have
  496.      overriden this by defining the environment variable `RSH' *at
  497.      installation time*.
  498. `-[0-7][lmh]'
  499.      Specify drive and density.
  500. `--multi-volume'
  501.      Create/list/extract multi-volume archive.
  502.      This option causes `tar' to write a "multi-volume" archive--one
  503.      that may be larger than will fit on the medium used to hold it.
  504.      FIXME: xref Multi
  505.      .
  506. `-L NUM'
  507. `--tape-length=NUM'
  508.      Change tape after writing NUM x 1024 bytes.
  509.      This option might be useful when your tape drivers do not properly
  510.      detect end of physical tapes.  By being slightly conservative on
  511.      the maximum tape length, you might avoid the problem entirely.
  512. `-F FILE'
  513. `--info-script=FILE'
  514. `--new-volume-script=FILE'
  515.      Execute `file' at end of each tape.  This implies `--multi-volume'
  516.      (`-M').
  517.    The Remote Tape Server
  518.    In order to access the tape drive on a remote machine, `tar' uses
  519. the remote tape server written at the University of California at
  520. Berkeley.  The remote tape server must be installed as `/etc/rmt' on
  521. any machine whose tape drive you want to use.  `tar' calls `/etc/rmt'
  522. by running an `rsh' or `remsh' to the remote machine, optionally using
  523. a different login name if one is supplied.
  524.    A copy of the source for the remote tape server is provided.  It is
  525. Copyright (C) 1983 by the Regents of the University of California, but
  526. can be freely distributed.  Instructions for compiling and installing
  527. it are included in the `Makefile'.
  528.    Unless you use the {No Value For "absolue-names"} option, GNU `tar'
  529. will not allow you to create an archive that contains absolute file
  530. names (a file name beginning with `/'.) If you try, `tar' will
  531. automatically remove the leading `/' from the file names it stores in
  532. the archive.  It will also type a warning message telling you what it
  533. is doing.
  534.    When reading an archive that was created with a different `tar'
  535. program, GNU `tar' automatically extracts entries in the archive which
  536. have absolute file names as if the file names were not absolute.  This
  537. is an important feature.  A visitor here once gave a `tar' tape to an
  538. operator to restore; the operator used Sun `tar' instead of GNU `tar',
  539. and the result was that it replaced large portions of our `/bin' and
  540. friends with versions from the tape; needless to say, we were unhappy
  541. about having to recover the file system from backup tapes.
  542.    For example, if the archive contained a file `/usr/bin/computoy',
  543. GNU `tar' would extract the file to `usr/bin/computoy', relative to the
  544. current directory.  If you want to extract the files in an archive to
  545. the same absolute names that they had when the archive was created, you
  546. should do a `cd /' before extracting the files from the archive, or you
  547. should either use the `--absolute-names' (`-P') option, or use the
  548. command `tar -C / ...'.
  549.    Some versions of Unix (Ultrix 3.1 is know to have this problem), can
  550. claim that a short write near the end of a tape succeeded, when it
  551. actually failed.  This will result in the -M option not working
  552. correctly.  The best workaround at the moment is to use a significantly
  553. larger blocksize than the default 20.
  554.    In order to update an archive, `tar' must be able to backspace the
  555. archive in order to reread or rewrite a block that was just read (or
  556. written).  This is currently possible only on two kinds of files: normal
  557. disk files (or any other file that can be backspaced with `lseek'), and
  558. industry-standard 9-track magnetic tape (or any other kind of tape that
  559. can be backspaced with the `MTIOCTOP' `ioctl'.
  560.    This means that the `--append' (`-r'), `--update' (`-u'),
  561. `--concatenate' (`-A'), and `--delete' commands will not work on any
  562. other kind of file.  Some media simply cannot be backspaced, which
  563. means these commands and options will never be able to work on them.
  564. These non-backspacing media include pipes and cartridge tape drives.
  565.    Some other media can be backspaced, and `tar' will work on them once
  566. `tar' is modified to do so.
  567.    Archives created with the `--multi-volume' (`-M'),
  568. `--label=ARCHIVE-LABEL' (`-V ARCHIVE-LABEL'), and `--incremental'
  569. (`-G') options may not be readable by other version of `tar'.  In
  570. particular, restoring a file that was split over a volume boundary will
  571. require some careful work with `dd', if it can be done at all.  Other
  572. versions of `tar' may also create an empty file whose name is that of
  573. the volume header.  Some versions of `tar' may create normal files
  574. instead of directories archived with the `--incremental' (`-G') option.
  575.    Some Common Problems and their Solutions:
  576. errors from system:
  577. permission denied
  578. no such file or directory
  579. not owner
  580. errors from `tar':
  581. directory checksum error
  582. header format error
  583. errors from media/system:
  584. i/o error
  585. device busy
  586. File: tar.info,  Node: Blocking,  Next: Many,  Prev: Device,  Up: Media
  587. Blocking
  588. ========
  589.      *(This message will disappear, once this node revised.)*
  590.    When writing to tapes, `tar' writes the contents of the archive in
  591. chunks known as "blocks".  To change the default blocksize, use the
  592. `--block-size=512-SIZE' (`-b 512-SIZE') option.  Each block will then
  593. be composed of SIZE records.  (Each `tar' record is 512 bytes.
  594. FIXME: xref Archive Format
  595.    .)  Each file written to the archive uses at least one full block.
  596. As a result, using a larger block size can result in more wasted space
  597. for small files.  On the other hand, a larger block size can ofter be
  598. read and written much more efficiently.
  599.    Further complicating the problem is that some tape drives ignore the
  600. blocking entirely.  For these, a larger block size can still improve
  601. performance (because the software layers above the tape drive still
  602. honor the blocking), but not as dramatically as on tape drives that
  603. honor blocking.
  604.    Wher reading an archive, `tar' can usually figure out the block size
  605. on itself.  When this is the case, and a non-standard block size was
  606. used when the archive was created, `tar' will print a message about a
  607. non-standard blocking factor, and then operate normally.  On some tape
  608. devices, however, `tar' cannot figure out the block size itself.  On
  609. most of those, you can specify a blocking factor (with
  610. `--block-size=512-SIZE' (`-b 512-SIZE')) larger than the actual
  611. blocking factor, and then use the `--read-full-blocks' (`-B') option.
  612. (If you specify a blocking factor with `--block-size=512-SIZE' (`-b
  613. 512-SIZE') and don't use the `--read-full-blocks' (`-B') option, then
  614. `tar' will not attempt to figure out the blocking size itself.)  On
  615. some devices, you must always specify the block size exactly with
  616. `--block-size=512-SIZE' (`-b 512-SIZE') when reading, because `tar'
  617. cannot figure it out.  In any case, use `--list' (`-t') before doing any
  618. extractions to see whether `tar' is reading the archive correctly.
  619.    If you use a blocking factor larger than 20, older `tar' programs
  620. might not be able to read the archive, so we recommend this as a limit
  621. to use in practice.  GNU `tar', however, will support arbitrarily large
  622. block sizes, limited only by the amount of virtual memory or the
  623. physical characteristics of the tape device.
  624.    If you are writing a compressed archive to tape with `--compress'
  625. (`-Z') or `--gzip' (`-z') (
  626. FIXME: pxref Input and Output
  627.    ), `tar' will not block the archive correctly.  This doesn't matter
  628. if you are writing the archive to a normal file or through a pipe, but
  629. if you are writing it to a tape drive, then this causes problems.  Use
  630. `--compress-blocks' or `--gzip-block' instead, to cause `tar' to
  631. arrange to have blocking work correctly.
  632. * Menu:
  633. * Format Variations::
  634. * Blocking Factor::
  635. File: tar.info,  Node: Format Variations,  Next: Blocking Factor,  Prev: Blocking,  Up: Blocking
  636. Format Variations
  637. -----------------
  638.      *(This message will disappear, once this node revised.)*
  639.    Format parameters specify how an archive is written on the archive
  640. media.  The best choice of format parameters will vary depending on the
  641. type and number of files being archived, and on the media used to store
  642. the archive.
  643.    To specify format parameters when accessing or creating an archive,
  644. you can use the options described in the following sections.  If you do
  645. not specify any format parameters, `tar' uses default parameters.  You
  646. cannot modify a compressed archive.  If you create an archive with the
  647. `--block-size=512-SIZE' (`-b 512-SIZE') option specified (
  648. FIXME: pxref Blocking
  649. Factor
  650.    ), you must specify that block-size when operating on the archive.
  651. FIXME: xref Matching Format Parameters
  652.    , for other examples of format parameter considerations.
  653. File: tar.info,  Node: Blocking Factor,  Prev: Format Variations,  Up: Blocking
  654. The Blocking Factor of an Archive
  655. ---------------------------------
  656.      *(This message will disappear, once this node revised.)*
  657.    The data in an archive is grouped into records, which are 512 bytes.
  658. Records are read and written in whole number multiples called "blocks".
  659. The number of records in a block (ie. the size of a block in units of
  660. 512 bytes) is called the "blocking factor".  The
  661. `--block-size=512-SIZE' (`-b 512-SIZE') option specifies the blocking
  662. factor of an archive.  The default blocking factor is typically 20 (ie.
  663. 10240 bytes), but can be specified at installation.  To find out the
  664. blocking factor of an existing archive, use `tar --list
  665. --file=ARCHIVE-NAME'.  This may not work on some devices.
  666.    Blocks are seperated by gaps, which waste space on the archive media.
  667. If you are archiving on magnetic tape, using a larger blocking factor
  668. (and therefore larger blocks) provides faster throughput and allows you
  669. to fit more data on a tape (because there are fewer gaps). If you are
  670. archiving on cartridge, a very large blocking factor (say 126 or more)
  671. greatly increases performance. A smaller blocking factor, on the other
  672. hand, may be usefull when archiving small files, to avoid archiving
  673. lots of nulls as `tar' fills out the archive to the end of the block.
  674. In general, the ideal block size depends on the size of the inter-block
  675. gaps on the tape you are using, and the average size of the files you
  676. are archiving.
  677. FIXME: xref Creating
  678. Archives
  679.    , for information on writing archives.
  680. FIXME: need example of using a cartridge with blocksize=126 or more
  681.    Archives with blocking factors larger than 20 cannot be read by very
  682. old versions of `tar', or by some newer versions of `tar' running on
  683. old machines with small address spaces.  With GNU `tar', the blocking
  684. factor of an archive is limited only by the maximum block size of the
  685. device containing the archive, or by the amount of available virtual
  686. memory.
  687.    If you use a non-default blocking factor when you create an archive,
  688. you must specify the same blocking factor when you modify that archive.
  689. Some archive devices will also require you to specify the blocking
  690. factor when reading that archive, however this is not typically the
  691. case.  Usually, you can use `--list' (`-t') without specifying a
  692. blocking factor--`tar' reports a non-default block size and then lists
  693. the archive members as it would normally.  To extract files from an
  694. archive with a non-standard blocking factor (particularly if you're not
  695. sure what the blocking factor is), you can usually use the
  696. `--read-full-blocks' (`-B') option while specifying a blocking factor
  697. larger then the blocking factor of the archive (ie. `tar --extract
  698. --read-full-blocks --block-size=300'.
  699. FIXME: xref Listing Contents
  700.    for more information on the `--list' (`-t') operation.
  701. FIXME: xref read-full-blocks
  702.    for a more detailed explanation of that option.
  703. `--block-size=NUMBER'
  704. `-b NUMBER'
  705.      Specifies the blocking factor of an archive.  Can be used with any
  706.      operation, but is usually not necessary with `--list' (`-t').
  707.    Device blocking
  708. `-b BLOCKS'
  709. `--block-size=BLOCKS'
  710.      Set block size to BLOCKS * 512 bytes.
  711.      This option is used to specify a "blocking factor" for the archive.
  712.      When reading or writing the archive, `tar', will do reads and
  713.      writes of the archive in blocks of BLOCK*512 bytes.
  714.      The default blocking factor is set when `tar' is compiled, and is
  715.      typically 20.
  716.      Blocking factors larger than 20 cannot be read by very old versions
  717.      of `tar', or by some newer versions of `tar' running on old
  718.      machines with small address spaces.
  719.      With a magnetic tape, larger blocks give faster throughput and fit
  720.      more data on a tape (because there are fewer inter-record gaps).
  721.      If the archive is in a disk file or a pipe, you may want to specify
  722.      a smaller blocking factor, since a large one will result in a large
  723.      number of null bytes at the end of the archive.
  724.      When writing cartridge or other streaming tapes, a much larger
  725.      blocking factor (say 126 or more) will greatly increase
  726.      performance.  However, you must specify the same blocking factor
  727.      when reading or updating the archive.
  728.      With GNU `tar' the blocking factor is limited only by the maximum
  729.      block size of the device containing the archive, or by the amount
  730.      of available virtual memory.
  731. `--block-compress'
  732.      Block the output of compression for tapes.
  733. `--ignore-zeros'
  734.      Ignore blocks of zeros in archive (means EOF).
  735.      The `--ignore-zeros' (`-i') option causes `tar' to ignore blocks
  736.      of zeros in the archive.  Normally a block of zeros indicates the
  737.      end of the archive, but when reading a damaged archive, or one
  738.      which was created by `cat'-ing several archives together, this
  739.      option allows `tar' to read the entire archive.  This option is
  740.      not on by default because many versions of `tar' write garbage
  741.      after the zeroed blocks.
  742.      Note that this option causes `tar' to read to the end of the
  743.      archive file, which may sometimes avoid problems when multiple
  744.      files are stored on a single physical tape.
  745. `--read-full-blocks'
  746.      Reblock as we read (for reading 4.2BSD pipes).
  747.      If `--read-full-blocks' (`-B') is used, `tar' will not panic if an
  748.      attempt to read a block from the archive does not return a full
  749.      block.  Instead, `tar' will keep reading until it has obtained a
  750.      full block.
  751.      This option is turned on by default when `tar' is reading an
  752.      archive from standard input, or from a remote machine.  This is
  753.      because on BSD Unix systems, a read of a pipe will return however
  754.      much happens to be in the pipe, even if it is less than `tar'
  755.      requested.  If this option was not used, `tar' would fail as soon
  756.      as it read an incomplete block from the pipe.
  757.      This option is also useful with the commands for updating an
  758.      archive.
  759.    Tape blocking
  760. FIXME: Appropriate options should be moved here from elsewhere.
  761.    When handling various tapes or cartridges, you have to take care of
  762. selecting a proper blocking, that is, the number of disk blocks you put
  763. together as a single tape block on the tape, without intervening tape
  764. gaps.  A "tape gap" is a small landing area on the tape with no
  765. information on it, used for decelerating the tape to a full stop, and
  766. for later regaining the reading or writing speed.  When the driver
  767. starts reading a tape block, the tape block has to be read whole
  768. without stopping, as a tape gap is needed to stop the tape motion
  769. without loosing information.
  770.    Using higher blocking (putting more disk blocks per tape block) will
  771. use the tape more efficiently as there will be less tape gaps.  But
  772. reading such tapes may be more difficult for the system, as more memory
  773. will be required to receive at once the whole block.  Further, if there
  774. is a reading error on a huge tape block, this is less likely that the
  775. system will succeed in recovering the information.  So, blocking should
  776. not be too low, nor it should be too high.  `tar' uses by default a
  777. blocking of 20 for historical reasons, and it does not really matter
  778. when reading or writing to disk.  Current tape technology would easily
  779. accomodate higher blockings.  Sun recommends a blocking of 126 for
  780. Exabytes and 96 for DATs.  Other manufacturers may use different
  781. recommendations for the same tapes.  This might also depends of the
  782. buffering techniques used inside modern tape controllers.  Some imposes
  783. a minimum blocking, or a maximum blocking.  Others request blocking to
  784. be some exponent of two.
  785.    So, there is no fixed rule for blocking.  But blocking at read time
  786. should ideally be the same as blocking used at write time.  At one place
  787. I know, with a wide variety of equipment, they found it best to use a
  788. blocking of 32 to guarantee that their tapes are fully interchangeable.
  789.    I was also told that, for recycled tapes, prior erasure (by the same
  790. drive unit that will be used to create the archives) sometimes lowers
  791. the error rates observed at rewriting time.
  792. File: tar.info,  Node: Many,  Next: Using Multiple Tapes,  Prev: Blocking,  Up: Media
  793. Many archives on one tape
  794. =========================
  795. FIXME: Appropriate options should be moved here from elsewhere.
  796.    Most tape devices have two entries in the `/dev' directory, or
  797. entries that come in pairs, which differ only in the minor number for
  798. this device.  Let's take for example `/dev/tape', which often points to
  799. the only or usual tape device of a given system.  There might be a
  800. corresponding `/dev/nrtape' or `/dev/ntape'.  The simpler name is the
  801. *rewinding* version of the device, while the name having `nr' in it is
  802. the *no rewinding* version of the same device.
  803.    A rewinding tape device will bring back the tape to its beginning
  804. point automatically when this device is opened or closed.  Since `tar'
  805. opens the archive file before using it and closes it afterwards, this
  806. means that a simple:
  807.      tar cf /dev/tape DIRECTORY
  808. will reposition the tape to its beginning both prior and after saving
  809. DIRECTORY contents to it, thus erasing prior tape contents and making
  810. it so that any subsequent write operation will destroy what has just
  811. been saved.
  812.    So, a rewinding device is normally meant to hold one and only one
  813. file.  If you want to put more than one `tar' archive on a given tape,
  814. you will need to avoid using the rewinding version of the tape device.
  815. You will also have to pay special attention to tape positioning.
  816. Errors in positionning may overwrite the valuable data already on your
  817. tape.  Many people, burnt by past experiences, will only use rewinding
  818. devices and limit themselves to one file per tape, precisely to avoid
  819. the risk of such errors.  Be fully aware that writing at the wrong
  820. position on a tape loses all information past this point and most
  821. probably until the end of the tape, and this destroyed information
  822. *cannot* be recovered.
  823.    To save DIRECTORY-1 as a first archive at the beginning of a tape,
  824. and leave that tape ready for a second archive, you should use:
  825.      mt -f /dev/nrtape rewind
  826.      tar cf /dev/nrtape DIRECTORY-1
  827.    "Tape marks" are special magnetic patterns written on the tape
  828. media, which are later recognizable by the reading hardware.  These
  829. marks are used after each file, when there are many on a single tape.
  830. An empty file (that is to say, two tape marks in a row) signal the
  831. logical end of the tape, after which no file exist.  Usually,
  832. non-rewinding tape device drivers will react to the close request issued
  833. by `tar' by first writing two tape marks after your archive, and by
  834. backspacing over one of these.  So, if you remove the tape at that time
  835. from the tape drive, it is properly terminated.  But if you write
  836. another file at the current position, the second tape mark will be
  837. erased by the new information, leaving only one tape mark between files.
  838.    So, you may now save DIRECTORY-2 as a second archive after the first
  839. on the same tape by issuing the command:
  840.      tar cf /dev/nrtape DIRECTORY-2
  841. and so on for all the archives you want to put on the same tape.
  842.    Another usual case is that you do not write all the archives the same
  843. day, and you need to remove and store the tape between two archive
  844. sessions.  In general, you must remember how many files are already
  845. saved on your tape.  Suppose your tape already has 16 files on it, and
  846. that you are ready to write the 17th.  You have to take care of skipping
  847. the first 16 tape marks before saving DIRECTORY-17, say, by using these
  848. commands:
  849.      mt -f /dev/nrtape rewind
  850.      mt -f /dev/nrtape fsf 16
  851.      tar cf /dev/nrtape DIRECTORY-17
  852.    In all the previous examples, we put aside blocking considerations,
  853. but you should do the proper things for that as well.
  854. FIXME: xref Blocking
  855. * Menu:
  856. * Tape Positioning::
  857. * mt::
  858. File: tar.info,  Node: Tape Positioning,  Next: mt,  Prev: Many,  Up: Many
  859. Tape Positions and Tape Marks
  860. -----------------------------
  861.      *(This message will disappear, once this node revised.)*
  862.    Just as archives can store more than one file from the file system,
  863. tapes can store more than one archive file.  To keep track of where
  864. archive files (or any other type of file stored on tape) begin and end,
  865. tape archive devices write magnetic "tape marks" on the archive media.
  866. Tape drives write one tape mark between files, two at the end of all
  867. the file entries.
  868.    If you think of data as a series of "0000"'s, and tape marks as
  869. "x"'s, a tape might look like the following:
  870.      0000x000000x00000x00x00000xx-------------------------
  871.    Tape devices read and write tapes using a read/write "tape head"--a
  872. physical part of the device which can only access one point on the tape
  873. at a time.  When you use `tar' to read or write archive data from a
  874. tape device, the device will begin reading or writing from wherever on
  875. the tape the tape head happens to be, regardless of which archive or
  876. what part of the archive the tape head is on.  Before writing an
  877. archive, you should make sure that no data on the tape will be
  878. overwritten (unless it is no longer needed).  Before reading an
  879. archive, you should make sure the tape head is at the beginning of the
  880. archive you want to read.  (The `restore' script will find the archive
  881. automatically.
  882. FIXME: xref Scripted
  883. Restoration
  884.    ).
  885. FIXME: xref mt
  886.    , for an explanation of the tape moving utility.
  887.    If you want to add new archive file entries to a tape, you should
  888. advance the tape to the end of the existing file entries, backspace
  889. over the last tape mark, and write the new archive file.  If you were
  890. to add two archives to the example above, the tape might look like the
  891. following:
  892.      0000x000000x00000x00x00000x000x0000xx----------------
  893.