31. Januar 2020 um 20:18 Uhr
Recover corrupted .tar.bzip2 archives
Sometimes one acutally need to access data from backups and archives.
Sometime archives to currupt. Better if one has not need using gzip to compress data as those are not recoverable.
One would be more lucky if she has used a tar archive, maybe compressed with bzip2, as the would be this helpful guid to recover alle the thing that were not within the corrupted block:
https://wiki.bluelightav.org/pages/viewpage.action?pageId=8126784
I was one of the ones today and I worked quit well for me
Shell history for later reference:
bzip2recover Archive.tar.bzip2
bzip2 -tv rec*.bz2 > testoutput.log 2>&1
grep [^ok]$ testoutput.log
mkdir recover1
mkdir recover2
(move everything up to the corrupted block to rec1 directory)
mv rec000[1-9]Archive.tar.bzip2.bz2 recover1
cd recover1
bzip2 -dc rec*.bz2 > recovery1.tar
tar tf recovery1.tar
cd ..
(move everthing above the crrupted block to recovery2)
cd recover2
bzip2 -dc rec*.bz2 > recovery2_failing.tar
bunzip2 ~/Downloads/find_tar_headers.pl.bz2
cp ~/Downloads/find_tar_headers.pl ./
chmod +x find_tar_headers.pl
./find_tar_headers.pl recovery2_failing.tar | head -n 1
recovery2_failing.tar:1848993:Media/pc020162.jpg:10572253
Not take the fist number from the result to:
tail -c +1848993 recovery2_failing.tar > recovery2_working.tar
tar tf recovery2_working.tar
tar xf recovery2_working.tar