seek on raw magtape

Henry Spencer henry at utzoo.UUCP
Sun Jan 5 12:13:12 AEST 1986


The major reason why tar is generally unwilling to add to a blocked tape
is the inability to (portably!) seek the tape backwards to rewrite the
last block of the previous contents.  The major reason for this inability
is that the "skip" primitives of tape systems seldom let you specify a
skip in bytes, or tell you how many bytes they have skipped -- they tend
to work in blocks only.

Contemplating this, an idea came.  Given this uncooperative behavior of
the hardware, the general seek-on-raw-magtape problem is intractable.
But most tapes that one would be interested in seeking on, notably tar
tapes, have a very simple structure.  They usually have at most two block
sizes, a main size plus perhaps a shorter one for the last block.  On a
tape like this, limited seeks are possible even with the usual hardware.
Specifically, on any tape one could seek to any block boundary within
the region of tape already traversed by reads or writes, by having the
driver remember the pattern of block sizes seen in those operations.
And on the usual tapes, the pattern is very simple.  The storage and
bookkeeping effort needed to remember it would be small.  Probably best
would be to remember the pattern since the last tape mark, which would
let one use seeks within one file on a multi-file tape.

Can anyone see any holes in this?
-- 
				Henry Spencer @ U of Toronto Zoology
				{allegra,ihnp4,linus,decvax}!utzoo!henry



More information about the Comp.unix.wizards mailing list