LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Can we verify a corrupted TAR? (https://www.linuxquestions.org/questions/linux-newbie-8/can-we-verify-a-corrupted-tar-361595/)

tsilok 09-08-2005 09:05 PM

Can we verify a corrupted TAR?
 
Hello, I am an used-to-be Windows user shifting to Red Hat Linux environment. I have a question on TAR verification.

Here is the scenario:
I am in the midst of testing whether I can get TAR to provide me with descriptive information of a corrupted TAR file. The verify(-W) attribute of TAR is not descriptive enough, it can only tell me, e.g.:

[oraprod@oracle02 test]$ tar Wtvf output.tar
>tar: 4 garbage bytes ignored at end of archive
>tar: Error exit delayed from previous errors

But what I would like to know is, for instance:
[1] The content of the TAR, with identification of the corrupted files
or
[2] More detailed information, if some portion of the TAR has corrupted.

Is that possible?

Thx,
Charisma

DaneM 09-09-2005 01:22 AM

Hi, Tsilok!

Yes, it's possible and pretty easy too. If you have an md5sum file that came with the archive you can type:

Code:

md5sum -c (nameofmd5sumfile.md5)
(It should say "OK")

or

Code:

cat (nameofmd5sumfile.md5) && md5sum (nameoftararchive.tar/.tar.gz/.tgz/.tar.bz2)
and compare the results.

Also, you can try:

Code:

tar -ztvf (nameoftararchive.tar.gz)
for .tar.gz files and .tgz files
or

Code:

tar -jtvf (nameoftararchive.tar.bz2)
for .tar.bz2 files

or

Code:

tar -tvf (nameoftararchive.tar)
for .tar files

That will list the files in the archive and give you an error message if it can't (pretend to) extract one or more of them.

Hope that helps.

--Dane

MensaWater 09-09-2005 07:55 AM

Of course you could just do a cat of the tar (or better a more of the tar). The header information can be seen but you'll have to pick it out of the other garbage.

SlackerLX 09-09-2005 08:45 AM

Perhaps you could also try "TARFIX" program
This package contains tools for processing and recovering damaged tar archive files

tsilok 09-12-2005 08:37 PM

Dear all,

Thanks for the assistance. I have figured it out.


All times are GMT -5. The time now is 09:05 AM.