You can try to save what is still possible with the utility cpio
.
(GNU cpio copies files into or out of a cpio or tar archive...)
The command below should do the job extracting the files and recreating the directory tree:
cpio -ivd -H tar < myfile.tar
Ps> Work in a safe place (directory).
In details:
-i
or --extract
Run in copy-in mode.
-d
or --make-directories
Create leading directories where needed.
(by default it doesn't create directory)
-v
or --verbose
as often write more informations, this time it lists the files processed.
-H format
or --format=format
Use archive format format.
Resume:
It's almost a complete tar
file. It has not the magic number in the header, it has the finals signature. Moreover you can read the part with text files (when you use less) so without compression. It's corrupted. Why (if because the server doesn't finish the job or it was transferred corrupting some parts) is secondary. If you can generate it again it's better. If not you can try what above or below...
References:
You can find the help on the site of cpio or on the mac site too.
Full option list
Alternatives:
Following this
post
and downloading this perl script,
after that you decompress it (with bunzip2
find_tar_headers.pl.bz2
) you can use it:
perl find_tar_headers.pl yourfile.tar
it will answer with a series of lines as
yourfile.tar:12345:dir/subdir/yourfile:126344
yourfile.tar:20578:dir/subdir/yourfile:123453 ...
read the 1st number, in this case 12345 and what follows should solve your problem
tail -c +12345 yourfile.tar > extracted_tail_yourfile.tar
tar xf extracted_tail_yourfile.tar
75 73 74 61 72 00 30 30
or 75 73 74 61 72 20 20 00
are the signatures for a tar file. (according with this list). You can write one of them at the offset 257 on a copy of your file with an hexadecimal editor or with dd
and it will be recognized as a tar
file. Probably you will be able to extract something too, but it will be still corrupted: it's better if you can generate it again.
tar tf tarfile.tar
list the files expected in the tar?