@c Maintenance notes:
@c 1. Pay attention to @FIXME{}s and @UNREVISED{}s
@c 2. Before creating final variant:
-@c 1.1. Run `make check-options' to make sure all options are properly
+@c 2.1. Run `make check-options' to make sure all options are properly
@c documented;
-@c 2.1. Run `make master-menu' (see comment before the master menu).
+@c 2.2. Run `make master-menu' (see comment before the master menu).
@include rendition.texi
@include value.texi
You can use @command{tar} archives in many ways. We want to stress a few
of them: storage, backup, and transportation.
-@FIXME{the following table entries need a bit of work..}
+@FIXME{the following table entries need a bit of work.}
@table @asis
@item Storage
Often, @command{tar} archives are used to store related files for
two different ways. People sometimes refer to @command{tar} ``commands''.
A @command{tar} @dfn{command} is the entire command line of user input
which tells @command{tar} what to do --- including the operation, options,
-and any arguments (file names, pipes, other commands, etc). However,
+and any arguments (file names, pipes, other commands, etc.). However,
you will also sometimes hear the term ``the @command{tar} command''. When
the word ``command'' is used specifically like this, a person is usually
referring to the @command{tar} @emph{operation}, not the whole line.
The archive member is a GNU @dfn{volume header} (@pxref{Tape Files}).
@item --Continued at byte @var{n}--
-Encountered only at the beginning of a multy-volume archive
+Encountered only at the beginning of a multi-volume archive
(@pxref{Using Multiple Tapes}). This archive member is a continuation
from the previous volume. The number @var{n} gives the offset where
the original file was split.
clearly diagnosed on @code{stderr}, after a line stating the nature of
the error.
-@GNUTAR{} returns only a few exit statuses. I'm really
-aiming simplicity in that area, for now. If you are not using the
-@option{--compare} @option{--diff}, @option{-d}) option, zero means
-that everything went well, besides maybe innocuous warnings. Nonzero
-means that something went wrong. Right now, as of today, ``nonzero''
-is almost always 2, except for remote operations, where it may be
-128.
+Possible exit codes of @GNUTAR{} are summarized in the following
+table:
+
+@table @asis
+@item 0
+@samp{Successful termination}.
+
+@item 1
+@samp{Some files differ}. If tar was invoked with @option{--compare}
+(@option{--diff}, @option{-d}) command line option, this means that
+some files in the archive differ from their disk counterparts
+(@pxref{compare}). If tar was given @option{--create},
+@option{--append} or @option{--update} option, this exit code means
+that some files were changed while being archived and so the resulting
+archive does not contain the exact copy of the file set.
+
+@item 2
+@samp{Fatal error}. This means that some fatal, unrecoverable error
+occurred.
+@end table
+
+If @command{tar} has invoked a subprocess and that subprocess exited with a
+nonzero exit code, @command{tar} exits with that code as well.
+This can happen, for example, if @command{tar} was given some
+compression option (@pxref{gzip}) and the external compressor program
+failed. Another example is @command{rmt} failure during backup to the
+remote device (@pxref{Remote Tape Server}).
@node using tar options
@section Using @command{tar} Options
@item -o
The function of this option depends on the action @command{tar} is
performing. When extracting files, @option{-o} is a synonym for
-@option{--no-same-owner}, i.e. it prevents @command{tar} from
+@option{--no-same-owner}, i.e., it prevents @command{tar} from
restoring ownership of files being extracted.
When creating an archive, it is a synonym for
@item --restrict
Disable use of some potentially harmful @command{tar} options.
-Currently this option disables shell invocaton from multi-volume menu
+Currently this option disables shell invocation from multi-volume menu
(@pxref{Using Multiple Tapes}).
@opsummary{rmt-command}
@opindex show-defaults
@GNUTAR{} has some predefined defaults that are used when you do not
-explicitely specify another values. To obtain a list of such
+explicitly specify another values. To obtain a list of such
defaults, use @option{--show-defaults} option. This will output the
values in the form of @command{tar} command line options:
file, which was meant to be saved, is rather destroyed.
@end enumerate
-So, recognizing the likelihood and the catastrophical nature of these
+So, recognizing the likelihood and the catastrophic nature of these
errors, @GNUTAR{} now takes some distance from elegance, and
cowardly refuses to create an archive when @option{--create} option is
given, there are no arguments besides options, and
versions of @command{tar} write garbage after the end-of-archive entry,
since that part of the media is never supposed to be read. @GNUTAR{}
does not write after the end of an archive, but seeks to
-maintain compatiblity among archiving utilities.
+maintain compatibility among archiving utilities.
@table @option
@item --ignore-zeros
@node Directory Modification Times and Permissions
@unnumberedsubsubsec Directory Modification Times and Permissions
-After sucessfully extracting a file member, @GNUTAR{} normally
+After successfully extracting a file member, @GNUTAR{} normally
restores its permissions and modification times, as described in the
previous sections. This cannot be done for directories, because
after extracting a directory @command{tar} will almost certainly
an incremental archive is reversed: first all directory members are
stored, followed by other (non-directory) members. So, when extracting
from incremental archives, @GNUTAR{} alters the above procedure. It
-remebers all restored directories, and restores their meta-data
+remembers all restored directories, and restores their meta-data
only after the entire archive has been processed. Notice, that you do
-not need to specity any special options for that, as @GNUTAR{}
+not need to specify any special options for that, as @GNUTAR{}
automatically detects archives in incremental format.
There may be cases, when such processing is required for normal archives
tar -xOzf foo.tgz bigfile1 bigfile2 | process
@end smallexample
-Hovewer, @option{--to-command} may be more convenient for use with
+However, @option{--to-command} may be more convenient for use with
multiple files. See the next section.
@node Writing to an External Program
the last level was created, you will need to restore from all backups
in turn. Continuing our example, to restore the state of @file{/usr}
file system, one would do@footnote{Notice, that since both archives
-were created withouth @option{-P} option (@pxref{absolute}), these
+were created without @option{-P} option (@pxref{absolute}), these
commands should be run from the root file system.}:
@smallexample
contents of the DUMPDIR header (with terminating nulls) when
@option{--incremental} or @option{--listed-incremental} option was
given, no matter what the verbosity level. This behavior, and,
-especially, the binary output it produced were considered incovenient
+especially, the binary output it produced were considered inconvenient
and were changed in version 1.16}:
@smallexample
the host machine must have @GNUTAR{} installed, and
must be able to access the directory containing the backup scripts and
their support files using the same file name that is used on the
-machine where the scripts are run (i.e. what @command{pwd} will print
+machine where the scripts are run (i.e., what @command{pwd} will print
when in that directory on that machine). If the host that contains
the file system does not have this capability, you can specify another
host as long as it can access the file system through NFS.
@defvr {Backup variable} RSH_COMMAND
-Full file name of @command{rsh} binary on remote mashines. This will
+Full file name of @command{rsh} binary on remote machines. This will
be passed via @option{--rsh-command} option to the remote invocation
of @GNUTAR{}.
@end defvr
@item -v[@var{level}]
@itemx --verbose[=@var{level}]
Set verbosity level. The higher the level is, the more debugging
-information will be output during execution. Devault @var{level}
+information will be output during execution. Default @var{level}
is 100, which means the highest debugging level.
@item -t @var{start-time}
@item -v[@var{level}]
@itemx --verbose[=@var{level}]
Set verbosity level. The higher the level is, the more debugging
-information will be output during execution. Devault @var{level}
+information will be output during execution. Default @var{level}
is 100, which means the highest debugging level.
@item -h
If you do not name the archive, @command{tar} uses the value of the
environment variable @env{TAPE} as the file name for the archive. If
that is not available, @command{tar} uses a default, compiled-in archive
-name, usually that for tape unit zero (i.e. @file{/dev/tu00}).
+name, usually that for tape unit zero (i.e., @file{/dev/tu00}).
@cindex Standard input and output
@cindex tar to standard input and output
Notice quoting of the pattern to prevent the shell from interpreting
it.
-The effect of @option{--wildcards} option is cancelled by
+The effect of @option{--wildcards} option is canceled by
@option{--no-wildcards}. This can be used to pass part of
the command line arguments verbatim and other part as globbing
patterns. For example, the following invocation:
Note: the @var{posix} standard does not specify what should happen
when you mix the @samp{g} and @var{number} modifiers. @GNUTAR{}
follows the GNU @command{sed} implementation in this regard, so
-the the interaction is defined to be: ignore matches before the
+the interaction is defined to be: ignore matches before the
@var{number}th, and then match and replace all matches from the
@var{number}th on.
@node directory
@subsection Changing the Working Directory
-@UNREVISED
@FIXME{need to read over this node now for continuity; i've switched
things around some.}
@smallexample
@group
--C
-/etc
+-C/etc
passwd
hosts
--C
-/lib
+--directory=/lib
libc.a
@end group
@end smallexample
$ @kbd{tar -c -f foo.tar --files-from list}
@end smallexample
-Notice also that you can only use the short option variant in the file
-list, i.e., always use @option{-C}, not @option{--directory}.
-
The interpretation of @option{--directory} is disabled by
@option{--null} option.
characters.
@item The maximum length of a symbolic link name is limited to
100 characters.
-@item Maximum size of a file the archive is able to accomodate
+@item Maximum size of a file the archive is able to accommodate
is 8GB
@item Maximum value of UID/GID is 2097151.
@item Maximum number of bits in device major and minor numbers is 21.
@GNUTAR{} is able to create and read compressed archives. It supports
@command{gzip} and @command{bzip2} compression programs. For backward
-compatibilty, it also supports @command{compress} command, although
+compatibility, it also supports @command{compress} command, although
we strongly recommend against using it, since there is a patent
covering the algorithm it uses and you could be sued for patent
infringement merely by running @command{compress}! Besides, it is less
@cindex Using encrypted archives
The @option{--use-compress-program} option, in particular, lets you
implement your own filters, not necessarily dealing with
-compression/decomression. For example, suppose you wish to implement
+compression/decompression. For example, suppose you wish to implement
PGP encryption on top of compression, using @command{gpg} (@pxref{Top,
gpg, gpg ---- encryption and signing tool, gpg, GNU Privacy Guard
Manual}). The following script does that:
@end smallexample
Suppose you name it @file{gpgz} and save it somewhere in your
-@env{PATH}. Then the following command will create a commpressed
+@env{PATH}. Then the following command will create a compressed
archive signed with your private key:
@smallexample
@opindex sparse
@item -S
@itemx --sparse
-This option istructs @command{tar} to test each file for sparseness
+This option instructs @command{tar} to test each file for sparseness
before attempting to archive it. If the file is found to be sparse it
is treated specially, thus allowing to decrease the amount of space
used by its image in the archive.
@node Other Tars
@subsection How to Extract GNU-Specific Data Using Other @command{tar} Implementations
-In previous sections you became acquainted with various quircks
+In previous sections you became acquainted with various quirks
necessary to make your archives portable. Sometimes you may need to
extract archives containing GNU-specific members using some
third-party @command{tar} implementation or an older version of
@node Split Recovery
@subsubsection Extracting Members Split Between Volumes
+@cindex Mutli-volume archives, extracting using non-GNU tars
If a member is split between several volumes of an old GNU format archive
most third party @command{tar} implementation will fail to extract
it. To extract it, use @command{tarcat} program (@pxref{Tarcat}).
@uref{http://www.gnu.org/@/software/@/tar/@/utils/@/tarcat.html, @GNUTAR{}
home page}. It concatenates several archive volumes into a single
valid archive. For example, if you have three volumes named from
-@file{vol-1.tar} to @file{vol-2.tar}, you can do the following to
+@file{vol-1.tar} to @file{vol-3.tar}, you can do the following to
extract them using a third-party @command{tar}:
@smallexample
$ @kbd{tarcat vol-1.tar vol-2.tar vol-3.tar | tar xf -}
@end smallexample
-You could use this approach for many (although not all) PAX
+@cindex Mutli-volume archives in PAX format, extracting using non-GNU tars
+You could use this approach for most (although not all) PAX
format archives as well. However, extracting split members from a PAX
archive is a much easier task, because PAX volumes are constructed in
-such a way that each part of a split member is extracted as a
+such a way that each part of a split member is extracted to a
different file by @command{tar} implementations that are not aware of
GNU extensions. More specifically, the very first part retains its
original name, and all subsequent parts are named using the pattern:
@item %n @tab Ordinal number of this particular part.
@end multitable
-For example, if, a file @file{var/longfile} was split during archive
+For example, if the file @file{var/longfile} was split during archive
creation between three volumes, and the creator @command{tar} process
had process ID @samp{27962}, then the member names will be:
Notice, that if the @command{tar} implementation you use supports PAX
format archives, it will probably emit warnings about unknown keywords
-during extraction. They will lool like this:
+during extraction. They will look like this:
@smallexample
@group
You can safely ignore these warnings.
If your @command{tar} implementation is not PAX-aware, you will get
-more warnigns and more files generated on your disk, e.g.:
+more warnings and more files generated on your disk, e.g.:
@smallexample
@group
@node Sparse Recovery
@subsubsection Extracting Sparse Members
+@cindex sparse files, extracting with non-GNU tars
Any @command{tar} implementation will be able to extract sparse members from a
PAX archive. However, the extracted files will be @dfn{condensed},
-i.e. any zero blocks will be removed from them. When we restore such
+i.e., any zero blocks will be removed from them. When we restore such
a condensed file to its original form, by adding zero bloks (or
@dfn{holes}) back to their original locations, we call this process
@dfn{expanding} a compressed sparse file.
+@pindex xsparse
To expand a file, you will need a simple auxiliary program called
@command{xsparse}. It is available in source form from
@uref{http://www.gnu.org/@/software/@/tar/@/utils/@/xsparse.html, @GNUTAR{}
home page}.
+@cindex sparse files v.1.0, extracting with non-GNU tars
Let's begin with archive members in @dfn{sparse format
version 1.0}@footnote{@xref{PAX 1}.}, which are the easiest to expand.
The condensed file will contain both file map and file data, so no
@end enumerate
In the unlikely case when this algorithm does not suite your needs,
-you can explicitely specify output file name as a second argument to
+you can explicitly specify output file name as a second argument to
the command:
@smallexample
-$ @kbd{xsparse @file{cond-file}}
+$ @kbd{xsparse @file{cond-file} @file{out-file}}
@end smallexample
It is often a good idea to run @command{xsparse} in @dfn{dry run} mode
The program behaves the same way all UNIX utilities do: it will keep
quiet unless it has simething important to tell you (e.g. an error
condition or something). If you wish it to produce verbose output,
-similar to that from the dry run mode, give it @option{-v} option:
+similar to that from the dry run mode, use @option{-v} option:
@smallexample
@group
@end group
@end smallexample
+@anchor{extracting sparse v.0.x}
+@cindex sparse files v.0.1, extracting with non-GNU tars
+@cindex sparse files v.0.0, extracting with non-GNU tars
An @dfn{extended header} is a special @command{tar} archive header
that precedes an archive member and contains a set of
@dfn{variables}, describing the member properties that cannot be
stored in the standard @code{ustar} header. While optional for
expanding sparse version 1.0 members, use of extended headers is
mandatory when expanding sparse members in older sparse formats: v.0.0
-and v.0.1 (The sparse formats are described in detail in @pxref{Sparse
-Formats}). So, for this format, the question is: how to obtain
+and v.0.1 (The sparse formats are described in detail in @ref{Sparse
+Formats}.) So, for this format, the question is: how to obtain
extended headers from the archive?
If you use a @command{tar} implementation that does not support PAX
@enumerate 1
@item
-Consult the documentation for your @command{tar} implementation for an
-option that will print @dfn{block numbers} along with the archive
+Consult the documentation of your @command{tar} implementation for an
+option that prints @dfn{block numbers} along with the archive
listing (analogous to @GNUTAR{}'s @option{-R} option). For example,
@command{star} has @option{-block-number}.
@item
-Obtain the verbose listing using the @samp{block number} option, and
-find the position of the sparse member in question and the member
+Obtain verbose listing using the @samp{block number} option, and
+find block numbers of the sparse member in question and the member
immediately following it. For example, running @command{star} on our
archive we obtain:
@opindex blocking-factor
The data in an archive is grouped into blocks, which are 512 bytes.
Blocks are read and written in whole number multiples called
-@dfn{records}. The number of blocks in a record (i.e. the size of a
+@dfn{records}. The number of blocks in a record (i.e., the size of a
record in units of 512 bytes) is called the @dfn{blocking factor}.
The @option{--blocking-factor=@var{512-size}} (@option{-b
@var{512-size}}) option specifies the blocking factor of an archive.
blocking factor (particularly if you're not sure what the blocking factor
is), you can usually use the @option{--read-full-records} (@option{-B}) option while
specifying a blocking factor larger then the blocking factor of the archive
-(i.e. @samp{tar --extract --read-full-records --blocking-factor=300}.
+(i.e., @samp{tar --extract --read-full-records --blocking-factor=300}.
@xref{list}, for more information on the @option{--list} (@option{-t})
operation. @xref{Reading}, for a more detailed explanation of that option.
they can use whatever media type the user finds convenient, they can
even be located on files.
-When creating a multi-volume arvhive, @GNUTAR{} continues to fill
+When creating a multi-volume archive, @GNUTAR{} continues to fill
current volume until it runs out of space, then it switches to
next volume (usually the operator is queried to replace the tape on
this point), and continues working on the new volume. This operation
-continues untill all requested files are dumped. If @GNUTAR{} detects
+continues until all requested files are dumped. If @GNUTAR{} detects
end of media while dumping a file, such a file is archived in split
form. Some very big files can even be split across several volumes.
The volume number used by @command{tar} in its tape-changing prompt
can be changed; if you give the
@option{--volno-file=@var{file-of-number}} option, then
-@var{file-of-number} should be an unexisting file to be created, or
+@var{file-of-number} should be an non-existing file to be created, or
else, a file already containing a decimal number. That number will be
used as the volume number of the first volume written. When
@command{tar} is finished, it will rewrite the file with the
that volume), use @option{--extract}, again without
@option{--multi-volume}.
-If an archive member is split across volumes (i.e. its entry begins on
+If an archive member is split across volumes (i.e., its entry begins on
one volume of the media and ends on another), you need to specify
@option{--multi-volume} to extract it successfully. In this case, you
should load the volume where the archive member starts, and use
@option{--label=@var{archive-label}} again in conjunction with the
@option{--append}, @option{--update} or @option{--concatenate} operation.
-@FIXME{This is no longer true: Multivolume archives in @samp{POSIX}
-format can be extracted using any posix-compliant tar
-implementation. The split members can then be recreated from parts
-using a simple shell script. Provide more information about it:}
-Beware that there is @emph{no} real standard about the proper way, for
-a @command{tar} archive, to span volume boundaries. If you have a
-multi-volume created by some vendor's @command{tar}, there is almost
-no chance you could read all the volumes with @GNUTAR{}.
-The converse is also true: you may not expect
-multi-volume archives created by @GNUTAR{} to be
-fully recovered by vendor's @command{tar}. Since there is little
-chance that, in mixed system configurations, some vendor's
-@command{tar} will work on another vendor's machine, and there is a
-great chance that @GNUTAR{} will work on most of
-them, your best bet is to install @GNUTAR{} on all
-machines between which you know exchange of files is possible.
+Notice that multi-volume support is a GNU extension and the archives
+created in this mode should be read only using @GNUTAR{}. If you
+absolutely have to process such archives using a third-party @command{tar}
+implementation, read @ref{Split Recovery}.
@node Tape Files
@subsection Tape Files
@cindex Listing volume label
The volume label will be displayed by @option{--list} along with
the file contents. If verbose display is requested, it will also be
-explicitely marked as in the example below:
+explicitly marked as in the example below:
@smallexample
@group
the archive label matches the one specified and will refuse to proceed
if it does not. Use this as a safety precaution to avoid accidentally
overwriting existing archives. For example, if you wish to add files
-to @file{archive}, presumably labelled with string @samp{My volume},
+to @file{archive}, presumably labeled with string @samp{My volume},
you will get:
@smallexample
@noindent
in case its label does not match. This will work even if
-@file{archive} is not labelled at all.
+@file{archive} is not labeled at all.
Similarly, @command{tar} will refuse to list or extract the
archive if its label doesn't match the @var{archive-label}
@appendix Configuring Help Summary
Running @kbd{tar --help} displays the short @command{tar} option
-summary (@pxref{help}). This summary is organised by @dfn{groups} of
+summary (@pxref{help}). This summary is organized by @dfn{groups} of
semantically close options. The options within each group are printed
in the following order: a short option, eventually followed by a list
of corresponding long option names, followed by a short description of
@appendix Index of Command Line Options
This appendix contains an index of all @GNUTAR{} long command line
-options. The options are listed without the preceeding double-dash.
+options. The options are listed without the preceding double-dash.
For a cross-reference of short command line options, @ref{Short Option Summary}.
@printindex op