QIC tapes and simulated double filemarks
Roy Badami
roy at gnomon.org.uk
Mon Oct 10 14:52:43 PDT 2005
The man page for sa(2), when talking about the two filemarks that are
normally used to signify end-of-tape, and the phantom file mark used
by QIC, says the following:
The exception to this is that there seems to be a standard (which
we follow, but don't understand why) that certain types of tape
do not actually write two file marks to tape, but when read,
report a `phantom' file mark when the last file is read. These
devices include the QIC family of devices. (It might be that
this set of devices is the same set as that of fixed block
devices. This has not been determined yet, and they are treated
as separate behaviors by the driver at this time.)
I don't know whether this mystery has long since been resolved, but I
thought I'd post an explanation for the benefit of those too young to
remember 9-track tapes and QIC-24/QIC-150 from the first time round.
Back in the Old Days, people used 9-track tapes; half-inch tape on
open reals. These systems really did support variable block sizes;
the logical blocks you wrote *were* the physical blocks on the tape,
and these could vary in size. The convention to signify end-of-tape
was to write two filemarks. If you later wanted to append to the
tape, you would position the tape between the filemarks and start
writing.
However 9-track tape drives were also rather expensive, and with the
advent of the workstation market there was a need for a more
affordable tape technology. (Remember, back in those days, tape was
the standard interchange format, and also the OS install media.
Workstations of that era could boot from tape.)
Back then, DEC were using TK50 tapes, HP were using a propriety
quarter inch cartridge, and Sun and pretty much everyone else used
QIC-24 and subsequently QIC-150.
QIC-24 was designed to be a low cost tape medium, and a number of
compromises were made in the design to eliminate unnecessary features
to keep the cost down. One was the elimination of variable block
sizes; the QIC-24 and QIC-150 drives only supported a fixed block
size, which simplied the logic in the drive. Another was the use of a
full width erase head. QIC-24 and QIC-150 drives use serpentine
recording, with the read and write heads moved over the appropriate
track by a stepper motor. However the ease head is a fixed head that
spans the entire width of the tape, and is only energised when writing
to track 1. This is fine for sequential writing, of course, because
by the time you start writing to track 2 you've traversed the entire
tape, hence ensuring that track 2 and all subsequent tracks have been
erased before they are written to.
However, this means that the drive can't support overwriting from an
arbitrary position on the tape; unless you were positioned on track 1,
the erase head wouldn't be energised and hence the data would be
written on tape that hadn't been erased, and would be garbled. As a
result, QIC-24 and QIC-150 drives essentially only support writing to
the tape when the tape is positioned either at BOM or EOD.
Essentially you can overwrite an entire tape, or you can append to the
end of the tape; you can't do anything else.
>From the above, the origin of the phantom filemark should be
reasonably obvious. QIC-24/QIC-150 tapes couldn't usefully use two
filemarks on the tape to signify EOT. There's no fundamental problem
with writing two filemarks, it's just that you'd never be able to
overwrite the second one if you wanted to append to the tape. You'd
have to append with the tape positioned at EOD (ie after the second
filemark) so you'd be left with a tape with a double filemark embedded
in the middle.
As to whether fixed block size and phantom filemarks are intrinsically
linked; I don't think so. Phantom filemarks, if anything, are linked
to the inability to write unless you're positioned at wither BOM or
EOD.
However, the next workstation tape technology that came along was the
Exabyte 8mm tape, essentially Video 8, which lacked the overwrite
restrictions of QIC (not being serpentine) and although retaining a
fixed physical blocksize, simulated variable block sizes in firmware
by separating the logical and physical tape structures. I think
pretty much all mainstream tape technologies since have adopted a
similar approach.
Hence whilst there's no fundamental connection between fixed block
size and phantom filemarks, QIC-24 and QIC-150 are probably the only
mainstream tape formats that had these properties.
Hope this is of interest to someone; and apologies if this is all
common knowledge to everyone reading this list...
-roy
More information about the freebsd-scsi
mailing list