I have a situation. I was supposed to run tar -x to recover a tar file from a tape but I pressed "c" and forgot to put the tape on readonly. The file was on fsf position 23, but the tape had 27 files. I know that file 23 is lost but since I pressed ctrl+c to cancel the tar command, can I still hope to somehow recover the other tar files? I tried fsf past file 23 and all I get is input/output error.

I was thinking maybe do a dump from file 23 using dd and then get this file and use a signature file recovery tool, like photorec. Is this doable?

  • 1
    I tried using dd with bs=10240 and it stops right after the point in the tape where I pressed ctrl+c from the tar. Is there a way to just read everything until the end of the tape? – StackUnder Sep 30 '13 at 15:30

This question is completely device specific, depending on the drive hardware and its associated driver.

When botching tape operations (like interrupting a write) you can easily make a non-readable symbol or even a non-readable stretch on the tape. You've already shown that your driver is not capable of reading past the junk your aborted write left since mt fsf just issues an ioctl that asks the driver to just skip to the next EOF mark. Since the driver returns EIO you are likely not going to be able to get it to do any better.

Depending on how vital this tape is to you, the next step is probably sending it to a forensic recovery firm skilled in the art of magtapes. Your data is probably there but most drivers don't know how to cope with the marker defect you introduced.

  • If I go to file 23 and build a small tar just to insert an EOF, could this allow the drive to be able to skip past 23? In the meanwhile, I going to test another device to read the tape. As soon as I can, I´ll post the specs of the first device for the sake of completeness, since it´s device specific. So dd is the right tool for the job, just not for my device, right? – StackUnder Oct 1 '13 at 1:30
  • 1
    Nopey. dd cannot do anything that the device driver doesn't afford and I've never seen any commercial drivers that do what you are hoping (writing an EOF at a specific location despite preceding junk). This is why people who have had too much experience with magtape are so glad we don't see much of it any longer. With paper-tape (which I never used) you could at least see the defects and fix them with a knife and glue, if only magtape were as forgiving. – msw Oct 1 '13 at 1:41

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.