Reading from tape

79 Views Asked by At

I want to read data from a tape and store that data on disk as a virtual tape. How to I maintain the original block structure of the tape? Some of the data I have requires the block structure stays the same. How to I establish what the block structure is on the source tape? I was thinking of writing the blocks to file with a header and footer structure and then using that to write back to tape/virtual tape maintaining the block structure. I can't work out how to establish the block structure of the data of the incoming data. I am doing this on Linux(Centos) in C. Language is not critical, will accept help in any language.

1

There are 1 best solutions below

0
Viswa On

As far as I know, your analysis is correct. Tape will not maintain any structure of files which it has. You should use "file marks" to find out the location of a file in a tape.

Actually process of writing a set of files to a tape goes something like this : Write 1st file, Write 1st filemark, Write 2nd file, Write 2nd filemark & so on. While restoring, for example, you need 2nd file to be restore, just jump to the 1st filemark on the tape & start reading it using ReadFile, till you reach the next file mark.

Here are some APIs you can use to do these operations said above :

  • Writing a file to tape : BackupRead & WriteFile
  • Write a file mark : WriteTapeMark
  • Restoring a file from tape : ReadFile & BackupWrite
  • Jumping to a filemark : SetTapePosition

In case any doubts arise, please get back to me.