SUMMARY : recover corrupted tar file

From: Yuan Lu (
Date: Sat Feb 25 1995 - 06:39:06 CST

> Hi managers,
> One user at my place accidentally overwrote a tar file by a empty file.
> The tar file archieved two HUGE data files, and they are the results of
> several months work. I want to know if there is such a tool that I can
> use to dump the data in the tar file and recover the second data file
> (it is better to recover both files, though). I will summarize if I
> get useful suggestions.
> Thanks a lot in advance.
> Here is what she did:
> 1. she archieved the data long time ago by command:
> tar cvf /dev/nrst1 file1 file2
> 2. now she wanted to retrieve the second file. Instead of using x option,
> she used the c option again as follows:
> tar cvf /dev/nrst1 file2
> Because file2 doesn't exist on the system, so she overwrote the tape by
> an ampty file

Hi managers,

Sorry for the delay. I tried to recover the data using the suggested methods,
but no luck. It seems my tarfile has more serious problems and all
attempts have failed. When I used dd command, I got NULL data. When I used
tarl program to read the tape, I got read error and "apparent EOF" errors.
Of ccourse, "mt -f /dev/nrst1 fsf 1" is the first command I used and it doesn't
work:-( At last, I used the method suggested by, still no luck.
So I gave up.

However, these tricks might be helpful to others and I appended the replies
at the end of the mail. Thanks to the people listed below. My special thanks
go to, who provided me with targ and tarl
programs, and Stan Hoffman, who faxed me an article on how to recover
tarfiles with bad header ( the article is on "Sys Admin" NOv/Dec 1993 issue).
frode@saturn (Frode Stromsvag)
Stan Hoffman

BTW, my tarfile was written on an exebyte tape.
 Yuan Lu
 Pacific Geoscience Centre Office: 604-363-6567
 Geological Survey of Canada Fax: 604-363-6565
 9800 West Sannich Road E-Mail:
 Sidney, BC, V8L 3B4
>From Tue Feb 21 00:48 PST 1995

The answer partly depends on the tape drive that was used. If it was a
QIC-150 then I think that you are out of luck. If the drive is one of
the helican scan drives (exabyte or dat) then the basic procedure is to
erase the EOF marker on the tape, then attempt to recover the data. To
erase the EOF marker try the following (ps I have never done this - so
use with care). Start writing to your tape - for instance use a tar
command. Soon after the tape has started to be written on (which may be
a few seconds after starting the command due to startup time), remove
power from the drive. This should erase the existing EOF marker, but not
allowing a new EOF marker to be written. Thus you should then be able to
rewind the tape and attempt to read back your files. The first file will
definitely corrupted (although the last part may be saved), while you
should be able to fuly recover the second file on the tape.

        Good luck.

Just a note for the future - I always write protect my tapes after
writing to them. This way I wont accidentally write over them. It
sometimes causes me to have to repeat a write command when I go to
re-use them, but that is minor problem with over writing important data.

>From saturn!frode Tue Feb 21 02:34 PST 1995

You can use the command

mt -f /dev/nrst1 fsf 1

to spool to end of the file she created last time.
Then try using tar from there.

tar xvf /dev/rst1 file2

>From Tue Feb 21 06:50 PST 1995

The solution to this is in an early edition of 'ROOT' magazine.

Basically, you create a new tar filr with the correct header (which apparently fills one block) and then use dd to splice teh first block of the new file to all but the first block of the damaged one.

I dont remember details, but have faith, it can be done.

Jeff Tate

P.S. chmod 444 very-important-file.tar

From: Dave Fetrow <>

 get targ


     targ, tarl - recover files from damaged tar-format archives

     targ file ...


     Written by Henry Spencer, Univ. of Toronto Zoology. This
     software is public domain. Manual page by Chris Robertson.

     From comp.sources.unix archives on

This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:10:17 CDT