Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When attempting to extract all files from a tar file, I get the following error message:

tar: Skipping to next header
tar: Error exit delayed from previous errors

Some of the files extract properly before this error message is printed, and the process results in a garbled file that seems to contain the rest of the archive. All of the files in this archive are text files.

Is there anything I can try to recover the rest of the files?

share|improve this question

You could try other versions of tar: gnu tar, star, bsdtar, etc. One of them might handle errors better.

You say your files are all text files, so you should be able to manually edit the file and select each file and copy/paste it to a new file. Look for tar's separator between each file, it looks like a block of ASCII NULLs with the file's metadata (name, permissions, timestamps, etc.) embedded in it.

share|improve this answer
cpio can also read .tar, and is a little more low level. – charlesbridge Jun 25 '09 at 18:56

You could try your extract with the -i option to ignore zeros:

The --ignore-zeros (-i) option causes tar to ignore blocks of zeros in
the archive. Normally a block of zeros indicates the end of the archive,
but when reading a damaged archive, or one which was created by cat-ing
several archives together, this option allows tar to read the entire
archive. This option is not on by default because many versions of tar
write garbage after the zeroed blocks.
share|improve this answer
Same error message, but thanks for the suggestion. – Scottie T Jun 25 '09 at 18:15

It's not pretty, but it'll work as a last resort:

Install "photorec" which may be included in the "testdisk" package on your distribution (both can be found here).

Type "photorec <foo.tar>" and follow the prompts (choose "None -- non partitioned media" and "other" for the filesytem option). It should be able to recover many of the files, though you'll have to identify and rename them all by hand. At least it beats losing everything. (For reference, I tar'ed up my /etc dir and tried this. Even on an un-damaged tar file, it only got 225 of 337 files, and even some of those were pretty munged up.)

An even more brute force approach would be to run "strings foo.tar > out.txt" to recover text data from the file, which would then need to be sorted through and put back into separate files by hand.

BTW... a google on "recover corrupt tar file" yielded several tools specific to your problem.

share|improve this answer
Thanks, I'll look into that. – Scottie T Jul 2 '09 at 18:08

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.