I've got a .tar.gz archive that has definitely suffered some kind of corruption. The data inside the archive is obviously very precious to me and I'd really like to get my hands on as much as possible. Obviously I don't expect to get all of it, but as much as possible would help.

This archive was sent to me over FTP, but was also corrupted on the end of the person who sent the archive. This should not have been damaged during the FTP transfer. I am unable to get another copy of it.

I've already attempted to do something about this, obviously. I've used an open-source application called gzrecover on the original archive then attempted to extract the "recovered" archive produced by gzrecover. However, this didn't avail me very far. I was able to get some of the files out of it, but not all of them. I viewed the archive in Ark (KDE's Archive Manager) and it is able to generate a full listing of the contents of the archive (so, all of the files and folders in the archive), so I have a little hope that the archive still has some kind of chance for recovery.

The original archive is about 18GB in size. The "recovered" archive is around 30GB in size.

I also used GNU cpio to extract from the recovered archive. It begins by successfully extracting some of the contents of the archive (for about two minutes), then begins spamming

cpio: Malformed number ��������

After running for quite a few days (and spamming my terminal for just as long), I finally get the message

cpio: premature end of file

As well, during the time of spamming "Malformed number", I do not have any kind of filesize increase from the folder it is extracting to. In other words, no data is recovered at all beyond that.

I've used the two following cpio commands to extract the archive:

cpio -ivd -H tar < archive.tar.recovered
cpio -F archive.tar.recovered -i -v

Needless to say, I have attempted to recover this archive multiple times with gzrecover as well as extracting each of them with both of these cpio commands.

I'm asking out of being entirely desperate to recover this data. What other methods can I use? How can I recover the data from this archive? The data in this archive means quite a bit to me and I would be distraught to lose it. I'll pretty much do anything to recover it.

Thank you.

  • @LMFAO_A_JOKE I wish I could. However, the source files are long since gone. The data is tens of thousands of files, varying in size. Multiple people have this archive and even the original sender has the archive, but it is corrupted on their end as well. This is literally my only way of obtaining these files. – Mythical Juggernaut Jan 3 '16 at 7:52
  • Am I missing the obvious ? your are using cpio to recover a tar.gz ? what about tar xvzf ? – Archemar Jan 7 '16 at 5:59
  • @Archemar I've always used cpio to extract from broken gzrecovered tar archives. Extracting it via tar xvzf fails miserably. – Mythical Juggernaut Jan 7 '16 at 6:20
  • @Archemar The provided hyperlink to gzrecover suggests using cpio – TOOGAM Jan 7 '16 at 6:42
  • To check if it is the same file of the source (and avoid to waste time) you can calculate the MD5 checksum, md5sum myfile.tar.gz, for both files. To try to fix an eventual and wrong Ascii transfer by ftp, you can follow this answer. To solve any eventual doubt about the compression format with file myfile.tar.gz you can check if it is really gzip compressed... – Hastur Jan 11 '16 at 10:20

A "gz" file is a compressed archive of a single file. A "tar" file is a collection of files wrapped up to appear to be a single file. Based on your description, you may be able to extract part of the tar file, but only up to the first error. You'll end up with a partial tar file. The tar contents could then be extracted, but since you only have the first bit, you'll only be able to extract whatever files got placed there.

This page describes all that in greater detail along with what you can do about it. The important bit is: gunzip < damaged.tar.gz | tar xvf -


A Windows product that claims the ability to repair .tar.gz archives is Archive Recovery.

This is a commercial product ($59), but a demo version is available here that contains all functionalities except saving.

Be minded that this could run for a long time and that success is not guaranteed.

  • I'll definitely try this. I don't have access to a Windows machine presently but I'll be picking one up in a couple of days. Thank-you. :) – Mythical Juggernaut Jan 12 '16 at 11:11
  • It might work using Wine. – harrymc Jan 12 '16 at 12:03
  • For optimal performance, it'd probably be best to get a Windows machine. I'll be taking an extra home from work so I should be able to do it tonight anyway. If I have any luck, I'll be sure to let you know. :) – Mythical Juggernaut Jan 13 '16 at 12:52
  • You can always setup a Virtualbox, install there a trial version of windows, on this the program and finally you can test it. Note that you can share a part of the guesting (Linux) file system to the hosted one (windows)... – Hastur Jan 13 '16 at 12:55
  • @Hastur Fair point. I want to be able to shut this computer at night though, so I marked this off as a no-go. I've got it running right now on another machine, but progress is pretty slow. – Mythical Juggernaut Jan 18 '16 at 1:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.