0

I want to continue extracting a tarfile on error, even if there is one or more corrupted files contained within the tarfile. Is this possible?

I have a tarfile myArchive.tar.gz. I want to extract/restore it so I run:

tar -xvf myArchive.tar.gz

The process extracts files up until a certain point, early exits, and I get this error:

gzip: stdin: unexpected end of file
tar: Unexpected EOF in archive
tar: Unexpected EOF in archive
tar: Error is not recoverable: exiting now

I also tried this command and got the same error:

tar --ignore-failed-read -xvf myArchive.tar.gz

I'm assuming there is a file within this archive that is corrupted (however, perhaps this error message means something else?).

I saw this stackexchange post but none of the answers say if it is possible to continue on error. The answers seem to focus on how a file might've become corrupted as opposed to answering if it is possible to continuing tarfile extraction on error.

1 Answer 1

2

unexpected EOF is not "continuable". EOF stands for "end of file". Your file is truncated. There's no more data to read. You can't recover from that.

This is like reading a book where someone ripped off the second half. You will surprisingly reach the end of the book in the middle of a chapter. But there's no way to continue reading the book.

You will have to go to the original bookstore and get another copy of your book that's not damaged.

1
  • PS: I do think the two top voted answers to the question you link to say very clearly you need to get the file again, i.e. that it's impossible to read the file. The short answer is simply "it's truncated": being truncated simply means being cut off. Dec 2, 2022 at 19:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .