Next: Sparse Recovery, Up: Other Tars
If a member is split between several volumes of an old GNU format archive most third party tar implementation will fail to extract it. To extract it, use tarcat program (see Tarcat). This program is available from GNU tar home page. It concatenates several archive volumes into a single valid archive. For example, if you have three volumes named from vol-1.tar to vol-2.tar, you can do the following to extract them using a third-party tar:
$ tarcat vol-1.tar vol-2.tar vol-3.tar | tar xf -
You could use this approach for many (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 different file by 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:
%d/GNUFileParts.%p/%f.%n
where symbols preceeded by ‘%’ are macro characters that have the following meaning:
Meta-character | Replaced By
|
---|---|
%d | The directory name of the file, equivalent to the
result of the dirname utility on its full name.
|
%f | The file name of the file, equivalent to the result
of the basename utility on its full name.
|
%p | The process ID of the tar process that
created the archive.
|
%n | Ordinal number of this particular part.
|
For example, if, a file var/longfile was split during archive creation between three volumes, and the creator tar process had process ID ‘27962’, then the member names will be:
var/longfile var/GNUFileParts.27962/longfile.1 var/GNUFileParts.27962/longfile.2
When you extract your archive using a third-party tar, these files will be created on your disk, and the only thing you will need to do to restore your file in its original form is concatenate them in the proper order, for example:
$ cd var $ cat GNUFileParts.27962/longfile.1 \ GNUFileParts.27962/longfile.2 >> longfile $ rm -f GNUFileParts.27962
Notice, that if the tar implementation you use supports PAX format archives, it will probably emit warnings about unknown keywords during extraction. They will lool like this:
Tar file too small Unknown extended header keyword 'GNU.volume.filename' ignored. Unknown extended header keyword 'GNU.volume.size' ignored. Unknown extended header keyword 'GNU.volume.offset' ignored.
You can safely ignore these warnings.
If your tar implementation is not PAX-aware, you will get more warnigns and more files generated on your disk, e.g.:
$ tar xf vol-1.tar var/PaxHeaders.27962/longfile: Unknown file type 'x', extracted as normal file Unexpected EOF in archive $ tar xf vol-2.tar tmp/GlobalHead.27962.1: Unknown file type 'g', extracted as normal file GNUFileParts.27962/PaxHeaders.27962/sparsefile.1: Unknown file type 'x', extracted as normal file
Ignore these warnings. The PaxHeaders.* directories created will contain files with extended header keywords describing the extracted files. You can delete them, unless they describe sparse members. Read further to learn more about them.