Child pages
  • How to recover data from a corrupted .tar.bz2 file?

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Ok, cd into recovery1.
Here, we have the beginning of a tar file, nothing's corrupted, but the tar file is not complete.
Right. That makes things easy.
We will just bunzip all the small archives into one recovery1.tar file:

Code Block
bzip2 \-dc rec*.bz2 > recovery1.tar

...

recovery2 !! cd ../recovery2
Hmmmm trying the same method as above fails. Why that ? Because tar sux. Yes, it does.
It does not manage to find a correct header right at the start of the file, and so, fails.
Creepy, huh ? But we are smarter than Tar, and there's not much that a little of Perl Magic can't solve.
First, let's have our bzip2 small archives bunziped into a "failing" tar.

Code Block
bzip2 \-dc rec*.bz2 > recovery2_failing.tar

...

To do so, do the following :

Code Block
tail \-c \+17185 recovery2_failing.tar > recovery2_working.tar

...

code
Code Block
tar tf recovery2_working.tar

Yoodelihoo ! You did it !!

...