[comp.sys.m88k] Cartridge tape handling

support@dg-rtp.dg.com (Data General Support) (09/01/90)

In article <1849@hsi86.hsi.UUCP>, stevens@hsi.UUCP (Richard Stevens) writes:

> I'm using a QIC-150 cartridge tape drive (SCSI interface) on a
> Data General AViiON, running DG/UX 4.30.  I'm trying to port a tape
> copying program from a BSD VAX...
> 
> What are the differences between these cartridge tape drives and
> "real" mag tapes ?  I'm aware of the limitation of writing 512-byte
> physical blocks.  That's fine -- everything I plan to write to the
> tape will be multiples of 512.  Is this the only difference ?
> Can I read and write EOF markers just like normal tapes ?
> Do they use a double EOF to mark the logical EOT ?

As you suspected, there are differences in the way that QIC-150 cartridge
tapes and 9-track magnetic tapes treat EOF and logical EOT markers.

Cartridge tapes supporting the QIC-150 interface only have ONE filemark
between files and ONE at the Logical-End-of-Tape (known as End-of-Recorded-
Media).  Due to restrictions in the write head on the tape drive itself, 
you can only write data in two locations:  
   (1) At Beginning-of-Tape (BOT)
   (2) At the End-of-Recorded-Media (appended to the end of the tape)
Due to this restriction it is impossible to support the standard
nine-track convention of one filemark between files and two filemarks
at the Logical-End-of-Tape because once a filemark is written you can
never overwrite it.
> 
> The problems I'm having are with *multiple* files on a single tape.
> (Multiple tape files, not multiple Unix files.)
> 
> For example, I rewind the tape, then write some records to the
> tape using tar.  I can read the tape using tar without any problems.
> But, if I rewind the tape, forward space one file (no-rewind device,
> of course) and then try to read the next file (expecting to hit the
> second EOF that should have been written when tar closed the device),
> I get a read error.  This implies that
>     (1) the driver didn't write two EOFs when tar closed the device;
>     (2) cartridge tapes don't use double EOFs to delineate the
>         logical EOT;
>     (3) the driver doesn't handle the reading of two consecutive
>         EOFs correctly.
 
Answer 2 is the correct one as explained above.

> As another test I rewind the tape and write some records to it using
> tar again.  When the tape is rewound I forward space one file, then
> use mt to write a single EOF.  This generates an "Invalid argument"
> error from the mt command.  This implies that
>     (1) you can't write an EOF after another EOF (i.e., you can't
>         write a double EOF on the tape);
>     (2) the driver is really broken.

Actually, neither of these is correct.  What is happening is that for
QIC-150 cartridge tapes, a status indicating whether the tape write
head is at the End-of-Recorded-Media or not is maintained.  When a
tape is written and rewound, the End-of-Recorded-Media status is
cleared.  When the tape is spaced forward one file, the tape drive 
doesn't realize it is at End-of-Recorded-Media and hence the Write
Filemark operation is not allowed.  In DG's SCSI tape driver we have included
a workaround such that this particular type of failure on the Write 
Filemark operation allows the write to succeed.  Since you are using 
an ioctl() call, you do not have this workaround, thus the error.

Data General customers who are experiencing problems with their 
systems or have questions about DG products are strongly urged to 
contact their Data General support representative for assistance.
--Data General Support