I've been using tar with its "–use-compress-prog=pbzip2" function to archive my files then compress them with pbzip2 to get an "*.tar.bz" archive.
Afterwards I checked the resulting file with pbzip2's "-t" switch, and it passed the test. However, to great surprise, I got "file incomplete" or other integrity errors when trying to extract the archive!
Is it because there might be something wrong with the tar file, but not when it was compressed by pbzip2? If so, is there a way to check the tar file itself? If not, what other problem might this be? Also, are there ways to recover data from tar files with errors?
I am afraid I might have already lost some important data through this process…
The point is, I would like to know a method to test the integrity of my archives after they are created.
Best Answer
First test bzip2 compression, It should output
OK
.Next uncompress the tarball, to get just the tar.
Finally verify the tar file,
Truthfully the best indicator of a problem, is a failed extraction. Hopefully you can narrow down the cause. I should also mention I have had the occasional archive fail verification, yet still correctly extract.