Re: Writing to tape from C system calls

Wolfgang Weisselberg <[email protected]> Sat, 13 Dec 2003 10:33:46 +0100
Newsgroups gmane.linux.tape
Message-ID <[email protected]>
Ujval Lodha ([email protected]) wrote 36 lines:

> When I write to it at any block that block becomes the last block on the
> device. I am unable to seek to any block after that on the tape.

Yes, this is how modern tape drives work (in hardware, IIRC).
Once you stop the writing process, the tape drive write an EOF
marker to finish the file and another EOF to mark the end of
the tape (2 EOF == EOT).  This second one is overwritten if you
append another file (assuming a non-rewind tape drive).

So after you wrote to the tape, you are, by definition, at the
end of the tape.

Some tapes allow 'partitions', so you can have 2 (or maybe even
more) EOT-markers, but you have to handle these partitions as
well.

> Is this normal? Is it not possible to use the tape device - and modify data
> at any block by seeking to it and writing?

Tape drives are not random access devices.  They are far too slow
and seeking around a lot is hard on the tape and the drive.  They
*much* prefer streaming.

If you really need something like that, consider
- caching the exceptions/rewitten blocks
- writing the exception table and data as an additional file at
  the end of the tape.
- using another medium for the exception table and data

-Wolfgang
-
To unsubscribe from this list: send the line "unsubscribe linux-tape" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html