Go to the previous, next section.

Archive format selection

(This message will disappear, once this node revised.)

Archive format selection

-V name
--label=name
Create archive with volume name name.

This option causes tar to write out a volume header at the beginning of the archive. If `--multi-volume' (`-M') is used, each volume of the archive will have a volume header of `name Volume n', where n is 1 for the first volume, 2 for the next, and so on.

-z
--gzip
--ungzip
Filter the archive through gzip.

This option works on physical devices (tape drives, etc.) and remote files as well as on normal files; data to or from such devices or remote files is reblocked by another copy of the tar program to enforce the specified (or default) block size. The default compression parameters are used; if you need to override them, avoid the `--gzip' (`-z') option and run gzip explicitly. (Or set the `GZIP' environment variable.)

If the `--gzip' (`-z') option is given twice, or the `--compress-blocks' option is used, tar will pad the archive out to the next block boundary (

FIXME: pxref Blocking
). This may be useful with some devices that require that all write operations be a multiple of a certain size.

The `--gzip' (`-z') option does not work with the `--multi-volume' (`-M') option, or with the `--update' (`-u'), `--append' (`-r'), `--concatenate' (`-A'), or `--delete' commands.

It is not exact to say that GNU tar is to work in concert with gzip in a way similar to zip, say. Surely, it is possible that tar and gzip be done with a single call, like in:

tar cfz archive.tar.gz subdir

to save all of `subdir' into a gzip'ed archive. Later you can do:

tar xfz archive.tar.gz

to explode and unpack.

The difference is that the whole archive is compressed. With zip, archive members are archived individually. tar's method yields better compression. On the other hand, one can view the contents of a zip archive without having to decompress it. As for the tar and gzip tandem, you need to decompress the archive to see its contents. However, this may be done without needing disk space, by using pipes internally:

tar tfz archive.tar.gz

About corrupted compressed archives: gzip'ed files have no redundancy, for maximum compression. The adaptive nature of the compression scheme means that the compression tables are implicitly spread all over the archive. If you lose a few blocks, the dynamic construction of the compression tables becomes unsychronized, and there is little chance that you could recover later in the archive.

There are pending suggestions for having a per-volume or per-file compression in GNU tar. This would allow for viewing the contents without decompression, and for resynchronizing decompression at every volume or file, in case of corrupted archives. Doing so, we might loose some compressibility. But this would have make recovering easier. So, there are pros and cons. We'll see!

-Z
--compress
--uncompress
Filter the archive through compress. Otherwise like `--gzip' (`-z').

--use-compress-program=prog
Filter through prog (must accept `-d').

Go to the previous, next section.