repair corrupt tar archives – the better way


More than ten years ago I wrote an article about how to repair corrupt tar archives [1] and, as a matter of fact, the original article plus the original solution how to extract as much data from the corrupt tar archives still receives a really high amount of traffic.

10 years is a long time and during those years I have received countless comments and suggestions from people around the globe.

Following a posting made on the original article a few weeks ago, I decided to dig out a really cool tool provided by a helpful soul some time ago. It is designed to extract as much data as possible, but in a much more efficient way than the original, more than 10 years old perl based solution.

The tool I am talking about is called “ft” (fix tar) and it is intended to be used as a command line tool, just as tar is 🙂

The author gave me permission to distribute the tool under the terms of the GNU Public License. You can grab it from here: [2]

This is no perl script, instead you have to compile it by yourself, which is hopefully nothing that scares you too much.

Usage is simple:

  • create a “repaired” tar file:
    ft < damaged.tar > repaired.tar
  • create a list of found files:
    ft < damaged.tar | tee repaired.tar | tar -tf - | tee list.txt
  • extract as much as you can:
    ft < damaged.tar | tar --backup=numbered -xvf -


  • no options, no output
  • a cut off file is appended a line break (an error message will be shown)
  • it is not guaranteed that TAR extensions actually exist in the expected
    data. In order to avoid unwanted overwriting, you should use tar as

    tar --backup=numbered -xvf repaired.tar

    or with option “-k”

  • vendor/POSIX extensions often start with names like
    ./@LongLink, ./@LongName or */PaxHeader/*

    those are not shown by tar, but cpio or pax do show them.

  • it is quite difficult to deal with all possible situations, due to this only the most likely are dealt with.

[1] old article with a perl based solution
[2] ft – fix tar sources

Spread the love

Leave a Reply

3 Comments on "repair corrupt tar archives – the better way"

newest oldest most voted
Notify of
Bryan A

THANK YOU! This little program is saving me a lot of time. I’ve been trying to recover data from a bunch of partial tar files.

J Gos

Is it working on .tar.gz also?

Post Navigation