[comp.sys.nsc.32k] ICM3216: appending on tapes.

barel@imag.UUCP (Max BAREL) (07/16/87)

I try many times to append on a tape.
In this way i use the device "/dev/[r]mt/0n" wich must invoque the driver
with the "no rewind on close" option.

SO:
  -Successives writes (from the begining of the media) works fine if no other
operation on the tape occurs between them.

  - successive read works but often need two retry between each iteration.

BUT:
To append on an already written tape one need:
  -rewind it.
  -forward skip files already there (with "mt fsf x", or reading them).
  -then write the new file.
This don't work (error: can't write output. etc...). I try many sequences
without success.

If someone could help...
-- 
-------------------------
Max Barel
barel@imag.UUCP

joer@nscpdc.NSC.COM (Joe Rawlings) (07/17/87)

Edited for brevity sake:

In article <1857@imag.UUCP> barel@imag.UUCP (Max BAREL) writes:
>I try many times to append on a tape.
>In this way i use the device "/dev/[r]mt/0n" wich must invoque the driver
>with the "no rewind on close" option.
>
>To append on an already written tape one need:
>  -rewind it.
>  -forward skip files already there (with "mt fsf x", or reading them).
>  -then write the new file.
>This don't work (error: can't write output. etc...). I try many sequences
>without success.
>
>If someone could help...
>-- 

There is a difference between the way an end of file (EOF) is marked and
the end of media (EOM) is marked on a cartridge tape.  Skipping the
technical jargon, the EOM is basically two or more EOF markers.  Using the
"mt fsf x" command will take the tape the the EOF marker corresponding to the
end of file structure "x".  When the cpio command is then invoked to write
a new file structure, the tape is checked to determine whether or not
the EOM has been passed (cpio will write at the beginning or end of a tape
only).  Since the "mt" command has NOT placed the tape past all EOF marks,
an error is generated.  This error is NOT FATAL to the operation, in fact,
after the "can't write output. etc", you are given the option to enter
a new device name.  After all this, the EOM has been reached and the cpio 
will succeed.

You do not NEED to rewind the tape if you know where you are on the tape.

Assuming a tape with three file systems.  The tape has been rewound previously
and has just been inserted into the tape drive:

	mt fsf 3
	find . | cpio -oBcv > /dev/rmt/0n
	error message, If you wish to continue enter new device/file name
	/dev/rmt/0
	......

	or

	mt fsf 4
	different error message
	find . | cpio -oBcv > /dev/rmt/0n
	...


Note: This is not a bug, this is the way the commands interact and is
      normal operation.

Cheers,

JR
-- 
/****************************************************************************** *                                                                             *
*  Joe Rawlings                         nsc!nscpdc!joer         or            * *  ICM Product Support                  tektronix!reed!nscpdc!joer            *
*  National Semiconductor Corp.         1-800-222-2433 (outside Oregon)       * *  Portland Development Center          or    629-4414 (inside Oregon)        *
*                                                                             * ******************************************************************************/

idall@augean.OZ (Ian Dall) (07/20/87)

In article <1857@imag.UUCP> barel@imag.UUCP (Max BAREL) writes:
>I try many times to append on a tape.
>To append on an already written tape one need:
>  -rewind it.
>  -forward skip files already there (with "mt fsf x", or reading them).
>  -then write the new file.
>This don't work (error: can't write output. etc...). I try many sequences
>without success.

Yes, it's a pain isn't it. I'll bet you have a Cipher/Emulux combination.

The trouble is that the erase head is the full width of the tape and erasing
is automatically done on a write to track 1. Over writing of existing data
is not permissible, therefore, because there is no way of erasing the existing
data without erasing the whole tape. An APPEND is possible but to do it
you need to first tell the tape to "seek to end of data" instead of "seek to
end of file". The former is an Emulux SCSI vendor specific command.

What is really needed is a modification to the "mt" command to support
"mt eod". This can be done using the SCSI "Pivot" driver but use care -
stuff it up and you will crash the system (or worse). The more correct
solution is to add an extra ioctl code to the tc driver.

This scsi pivot driver can be used to perform all sorts of other operations
which no one thought to integrate more elegantly into this unix port.
Neither the ROM monitor nor any of the unix utilities support remapping
of bad disk blocks, for example, but it is fairly easy to write a program
using the scsi driver to do this. I can supply a copy to anyone who is
interested. It's pretty primative but it is an example of how to use the
scsi driver. I figured it out by reading the driver source so I suppose
anyone else can too.

-- 
 Ian Dall           "In any argument there will be people on your
                     side who you wish were on the other side."
idall@augean.oz

gfm@devel.cats.oz (Graham Menhennitt) (07/21/87)

In article <885@nscpdc.NSC.COM> joer@nscpdc.UUCP (Joe Rawlings) writes:
>
>There is a difference between the way an end of file (EOF) is marked and
>the end of media (EOM) is marked on a cartridge tape.  Skipping the
>technical jargon, the EOM is basically two or more EOF markers.  Using the
>"mt fsf x" command will take the tape the the EOF marker corresponding to the

If your tape device driver is written correctly you won't have this problem.
The correct way of handling a close on a tape device that has been open for
writing is to mark it with an EOM. As Joe says this is simply two EOF marks.
The trick is that after writing the second mark the device driver should
backspace the tape to the point between the two marks. Then, if the non-rewind
tape device was used and the device is subsequently re-opened for writing,
the second EOF will be overwritten and the tape will correctly have one EOF
between the two files.
-- 
Graham Menhennitt		    ACSnet: gfm@devel.cats.oz
Networking II Project Manager	    UUCP: ...!seismo!munnari!devel.cats.oz!gfm
Cats Co., Melbourne, Australia.	    Phone: +61 3 5224246

joer@nscpdc.NSC.COM (J.H.Rawlings III) (07/22/87)

In article <258@devel.cats.oz> gfm@devel.cats.oz (Graham Menhennitt) writes:

>If your tape device driver is written correctly you won't have this problem.
>The correct way of handling a close on a tape device that has been open for
>writing is to mark it with an EOM. As Joe says this is simply two EOF marks.
>The trick is that after writing the second mark the device driver should
>backspace the tape to the point between the two marks. Then, if the non-rewind
>tape device was used and the device is subsequently re-opened for writing,
>the second EOF will be overwritten and the tape will correctly have one EOF
>between the two files.

This is the way that the tape device driver works.  Note that multiple
"cpio" files can be written to tape as long as they are written in one
session with the non-rewind driver.  Once the tape has been rewound, the
"error message senario" is mandated.


In article  <219@augean.OZ> idall@augean.OZ (Ian Dall) writes:

>The trouble is that the erase head is the full width of the tape and erasing
>is automatically done on a write to track 1.
					   ^ 
Should be track 0.
					   
>What is really needed is a modification to the "mt" command to support
>"mt eod".

Yes, and recognizing that, we at National Semiconductor Corporation Portland
Development Center (NSCPDC) have done just that.  In the newest release of
the System V/Series 32000 (tm) Software (revision F), the "mt" command has been
modified so that "cpio" commands can be appended to tape even if the tape
has been rewound.  The new command is "mt -f <device> append" where <device>
refers to the tape device (usually /dev/rmt/0n).

How new is this release?  It was released yesterday, (Tues, 7/21/87).

NSCPDC periodically produces maintenance releases to fix reported bugs and
to add enhancements, (requested and otherwise).  For more information about
the newest release, call the NSCPDC Technical Support Hot-Line.

-- 
/****************************************************************************** *                                                                             *
*  Joe Rawlings                         nsc!nscpdc!joer                       * *  ICM Product Support                  tektronix!reed!nscpdc!joer            *
*  National Semiconductor Corp.         1-800-222-2433 (outside Oregon)       * *  Portland Development Center          (503)-629-4414 (Oregon/World)         *
*                                                                             * ******************************************************************************/

joemu@nscpdc.NSC.COM (Joe Mueller) (07/22/87)

In a previous article Grahm Menhennitt writes:
> If your tape device driver is written correctly you won't have this problem.
> The correct way of handling a close on a tape device that has been open for
> writing is to mark it with an EOM. As Joe says this is simply two EOF marks.
> The trick is that after writing the second mark the device driver should
> backspace the tape to the point between the two marks. Then, if the non-rewind
> tape device was used and the device is subsequently re-opened for writing,
> the second EOF will be overwritten and the tape will correctly have one EOF
> between the two files.

Interesting idea, but impossible to do on emulex controllers. You can only
space forward.

In article <219@augean.OZ>, idall@augean.OZ (Ian Dall) writes:
> What is really needed is a modification to the "mt" command to support
> "mt eod". This can be done using the SCSI "Pivot" driver but use care -
> stuff it up and you will crash the system (or worse). The more correct
> solution is to add an extra ioctl code to the tc driver.

It's funny (but I'm happy) that someone proposed the exact solution I came
up with. I've added a new option to the mt command called "append". It uses a
new ioctl that positions the tape to the end of recorded data. You may only
write information at the very end of all recorded information or starting at
the beginning of the tape. It is still impossible (for example) to write 3
files to the tape, rewind, forward over 2 of the files, and overwrite the
third.

I'm always happy to consider improvements to our device drivers, if you
have any other suggestions, try sending them directly to me or go through
our techincal support group.