[comp.unix.i386] Tape retensioning

paul@actrix.co.nz (Paul Gillingwater) (01/06/90)

Hi,
I just got my 150 Mb tape drive running under ISC 386/ix 2.0.2.
I wanted to retension some new tapes, prior to using them for data.
So, i tried the Xenix command:
	tape reten

But I couldn't find anything like this for ISC.  The man(8) page
only gave me details of the driver, but no info on simple
utilities for tape handling.  So, I whipped up a 7 line C program
that simply used the ioclt for a TAPE_RETEN (see tape(8)).

But what happens to new users who haven't got a C compiler?
How do *they* retension their tapes?  And yes, I tried RTFM...
-- 
Paul Gillingwater, paul@actrix.co.nz

johnl@esegue.segue.boston.ma.us (John R. Levine) (01/08/90)

In article <1990Jan6.063506.8670@actrix.co.nz> paul@actrix.co.nz (Paul Gillingwater) writes:
>But what happens to new users who haven't got a C compiler?
>How do *they* retension their tapes?  And yes, I tried RTFM...

A quick look at the permuted index in the FM reveals the existence of the 
"tapecntl" command, and its -t for retension option.

Better luck with the FM next time.
-- 
John R. Levine, Segue Software, POB 349, Cambridge MA 02238, +1 617 864 9650
johnl@esegue.segue.boston.ma.us, {ima|lotus|spdcc}!esegue!johnl
"Now, we are all jelly doughnuts."

jgd@rsiatl.UUCP (John G. De Armond) (01/08/90)

In article <1990Jan8.034014.3445@esegue.segue.boston.ma.us> johnl@esegue.segue.boston.ma.us (John R. Levine) writes:
>In article <1990Jan6.063506.8670@actrix.co.nz> paul@actrix.co.nz (Paul Gillingwater) writes:
>>But what happens to new users who haven't got a C compiler?
>>How do *they* retension their tapes?  And yes, I tried RTFM...
>
>A quick look at the permuted index in the FM reveals the existence of the 
>"tapecntl" command, and its -t for retension option.
>
>Better luck with the FM next time.

Yes, the FM does mention tapecntl but the existance of this utility and
the /dev/rmt/... devices apparently depend on the tape driver in use.
If a SCSI-based tape is used and accessed through the hpdd driver, then
I assume in this case that the driver is AT&T's and/or part of the hpdd driver. 

If, on the other hand, one is using a Wantek drive and the wt 
device driver supplied by interactive (as am I), then a whole 'nuther set 
of constraints exist.  One should look in wt(7) instead of 
tape(7).  When this driver is used, one has 2 devices to work 
with - /dev/tape which rewinds and /dev/ntape which does not.  
2 ioctl(2) calls are supported - ERASE and RETTENS - both
with obvious meanings.  NO utility is mentioned or exists to my knowledge.
I did the same thing Paul did and wrote a small utility to make the ioctl(2)
calls.  Otherwise, one is SOL.  Sure wish Interactive would support the
Wantek drive as well as it does the SCSI-based drives.

John


-- 
John De Armond, WD4OQC                     | The Fano Factor - 
Radiation Systems, Inc.     Atlanta, GA    | Where Theory meets Reality.
emory!rsiatl!jgd          **I am the NRA** | 

cpcahil@virtech.uucp (Conor P. Cahill) (01/08/90)

In article <1990Jan6.063506.8670@actrix.co.nz>, paul@actrix.co.nz (Paul Gillingwater) writes:
> Hi,
> I just got my 150 Mb tape drive running under ISC 386/ix 2.0.2.
> I wanted to retension some new tapes, prior to using them for data.
> So, i tried the Xenix command:
> 	tape reten
> 
> But I couldn't find anything like this for ISC.  The man(8) page
> only gave me details of the driver, but no info on simple
> utilities for tape handling.  So, I whipped up a 7 line C program
> that simply used the ioclt for a TAPE_RETEN (see tape(8)).


If you would have used the permuted index to look up the word "tape" you 
would have found the following entry:

	tapecntl:  tape control for QIC-24/QIC-02 tape device

And looking there (on the tapecntl(1) man page) you would have seen 
options to erase, retention, reset, rewind, and position on the 
tape drive.

Sounds like what you are looking for.  (Yes I know that you have a QIC-150
tape drive, but the ioctl commands should be the same for both).
-- 
+-----------------------------------------------------------------------+
| Conor P. Cahill     uunet!virtech!cpcahil      	703-430-9247	!
| Virtual Technologies Inc.,    P. O. Box 876,   Sterling, VA 22170     |
+-----------------------------------------------------------------------+

jackv@turnkey.gryphon.COM (Jack F. Vogel) (01/08/90)

In article <1990Jan8.034014.3445@esegue.segue.boston.ma.us> johnl@esegue.segue.boston.ma.us (John R. Levine) writes:
>In article <1990Jan6.063506.8670@actrix.co.nz> paul@actrix.co.nz (Paul Gillingwater) writes:
>>But what happens to new users who haven't got a C compiler?
>>How do *they* retension their tapes?  And yes, I tried RTFM...
 
>A quick look at the permuted index in the FM reveals the existence of the 
>"tapecntl" command, and its -t for retension option.
 
Well, AT&T's FM does indeed contain a man page for this command, but as far
as I can tell ISC doesn't ship the thing so Paul's complaint stands. Could
someone at ISC comment, just what is a user in that situation supposed to do??
If you have an Archive tape and get your driver from them, they include a
program called ctape that works about like SCO's tape command, rewinds,
retentions, displays status, etc. Oh, and even some users that have the
development system are not going to be experienced enough to write the code
necessary to do this. ISC really should provide something, at least for the
tape they provide drivers for.

Disclaimer: As usual, IMHO only!

-- 
Jack F. Vogel			jackv@seas.ucla.edu
AIX Technical Support	              - or -
Locus Computing Corp.		jackv@ifs.umich.edu

tneff@bfmny0.UU.NET (Tom Neff) (01/09/90)

I think that since there are only a few basic kinds of cartridge tape
interfaces out there, and since 386 UNIX binaries are pretty darn
portable across sibling platforms, it might be a nice idea to compile
and UUENCODE a set of simple binaries for commands that do NOTHING but
retension (for instance) the tape.  Then users without the development
set could grab the appropriate mini-tool and use it.  (Assuming they
got UUDECODE running on a non-development system.)

At minimum, a set of retension sources would be good.
-- 
Stalinism begins at home.  }{  Tom Neff  }{  tneff@bfmny0.UU.NET

cpcahil@virtech.uucp (Conor P. Cahill) (01/09/90)

In article <6412@turnkey.gryphon.COM>, jackv@turnkey.gryphon.COM (Jack F. Vogel) writes:
>  
> Well, AT&T's FM does indeed contain a man page for this command, but as far
> as I can tell ISC doesn't ship the thing so Paul's complaint stands. Could
> someone at ISC comment, just what is a user in that situation supposed to do??

I couldn't find the tapecntl command either.  However I did find an "mt"
command which seems to be the program you want.  However, even though a 
strings of /bin/mt shows the commands: retension, rewind, fsf, etc., the use
of any of these commands always results in a "command not available" or a
"command not recognized".  

So it looks like the original poster is correct: If you need to perform one
of these operations you must write a program to do it yourself.  However,
I have been using 1/4" cartridge tapes for almost 3 years and haven't had
a need to do any of these.

In any case, Interactive should provide such a program.

-- 
+-----------------------------------------------------------------------+
| Conor P. Cahill     uunet!virtech!cpcahil      	703-430-9247	!
| Virtual Technologies Inc.,    P. O. Box 876,   Sterling, VA 22170     |
+-----------------------------------------------------------------------+

support@ism780c.isc.com (Support account) (01/11/90)

In article <1990Jan9.133438.8417@virtech.uucp> cpcahil@virtech.uucp (Conor P. Cahill) writes:
>In any case, Interactive should provide such a program.

Interactive is working on providing a command to retension, rewind,
seek eof etc. tapes. At present, these types of features are only
implemented via ioctl calls, as previous posters have indicated,
for both Wangtek type drives and SCSI tape devices.

tim@comcon.UUCP (Tim Brown) (01/11/90)

One solution I have come across is to bulk erase the tape.  I had several
tapes that would not work at all, couldn't retens or anything through
unix so bulk erased them, bingo they work perfect.  You can get bulk
erasers from any electrical supply house.

This is a wangtek variety.

Tim Brown                           |
Computer Connection                 |
(attmail or uunet)!comcon!tim       |

jrh@mustang.dell.com (James R. Howard) (01/11/90)

> Hi,
> I just got my 150 Mb tape drive running under ISC 386/ix 2.0.2.
> I wanted to retension some new tapes, prior to using them for data.
> So, i tried the Xenix command:
> 	tape reten
> 
> But I couldn't find anything like this for ISC.  The man(8) page
> only gave me details of the driver, but no info on simple
> utilities for tape handling.  So, I whipped up a 7 line C program
> that simply used the ioclt for a TAPE_RETEN (see tape(8)).
> 

What's wrong with the following:

tapecntl -t

This will retension a tape just fine.

James R. Howard                
cs.utexas.edu!dell!mustang!jrh

#include <disclaimer.h>

paul@csnz.co.nz (Paul Gillingwater) (01/11/90)

In article <1990Jan8.034014.3445@esegue.segue.boston.ma.us> johnl@esegue.segue.boston.ma.us (John R. Levine) writes:
>In article <1990Jan6.063506.8670@actrix.co.nz> paul@actrix.co.nz (Paul Gillingwater) writes:
>>But what happens to new users who haven't got a C compiler?
>>How do *they* retension their tapes?  And yes, I tried RTFM...
>
>A quick look at the permuted index in the FM reveals the existence of the 
>"tapecntl" command, and its -t for retension option.
>
>Better luck with the FM next time.

Thanks for that info, John.  I can only say in my defence that ISC weren't
even *SHIPPING* reference manuals when I bought ISC 2.0.1.  They told me
to use some generic AT&T V.3.0 manuals, which contain no reference to
"tapecntl" in either the User's Reference or System Admin Ref.

I note that ISC have now changed their packaging to include printed
manuals  --- I mean the real reference manuals, not their extended
release notes.  And the good news is that they will include man pages
with the next release.

BTW, re the next release: has anyone heard any announcements re an
upgrade path to ISC's release of V.4.0?  I've only had my 2.0.2
for a couple of months...  

Also, can someone please post a list of all the ISC updates, X1..X6..?
The local supplier doesn't like to reveal their existence...
-- 
Paul Gillingwater, Computer Sciences of New Zealand Limited
Domain: paul@csnz.co.nz  Bang: uunet!vuwcomp!dsiramd!csnz!paul
Call Magic Tower BBS V21/23/22/22bis 24 hrs NZ+64 4 767 326
SpringBoard BBS for Greenies! V22/22bis/HST NZ+64 4 896 016

paul@csnz.co.nz (Paul Gillingwater) (01/11/90)

In article <1990Jan8.120012.3952@virtech.uucp> cpcahil@virtech.uucp (Conor P. Cahill) writes:
>If you would have used the permuted index to look up the word "tape" you 
>would have found the following entry:

In fact i did RTFM.  But ISC didn't SHIP TFM.  I had to use a generic 
AT&T V.3.0 User Reference, which has no mention of tapecntl in
its perverted index.  Please check your facts next time.

-- 
Paul Gillingwater, Computer Sciences of New Zealand Limited
Domain: paul@csnz.co.nz  Bang: uunet!vuwcomp!dsiramd!csnz!paul
Call Magic Tower BBS V21/23/22/22bis 24 hrs NZ+64 4 767 326
SpringBoard BBS for Greenies! V22/22bis/HST NZ+64 4 896 016

jrh@mustang.dell.com (James R. Howard) (01/11/90)

Hmmm, Dell UNIX (based on ISC) has an added tapecntl that does work with the
Wangtek (wt) driver.  Not sure why ISC has man pages for the command, but does
not ship it....

James R. Howard                
cs.utexas.edu!dell!mustang!jrh

#include <disclaimer.h>

gerry@zds-ux.UUCP (Gerry Gleason) (01/13/90)

In article <246@comcon.UUCP> tim@comcon.UUCP (Tim Brown) writes:
>One solution I have come across is to bulk erase the tape.  I had several
>tapes that would not work at all, couldn't retens or anything through
>unix so bulk erased them, bingo they work perfect.  You can get bulk
>erasers from any electrical supply house.

But this is not the same thing.  Another poster noted that he rarely
had to use such a thing, but if you are one to follow all the instuctions,
the tape cartridges I have say to retension before using the first time
and a few other conditions.  This has nothing to do with magnetic state
of the tape, it's for physical care.  I don't know what problems you
could have if you don't, but I assume your reliability would go down.
A little, a lot, who knows.

Gerry Gleason

paul@actrix.co.nz (Paul Gillingwater) (01/14/90)

In article <5082@dell.dell.com> jrh@mustang.dell.com (James R. Howard) writes:
>> I wanted to retension some new tapes, prior to using them for data.
>What's wrong with the following:
>tapecntl -t
>This will retension a tape just fine.

My copy of ISC 386/ix 2.02 doesn't have the tapecntl command.

-- 
Paul Gillingwater, paul@actrix.co.nz

buck@siswat.UUCP (A. Lester Buck) (01/15/90)

It certainly isn't very hard to do a tape manipulating program.  Here is
what I wrote several years ago to follow the man page for "mt", the SVR2
tape manipulating command.  This was for use with some tape drivers I was
moving around from system to system, so I had to be able to move the IOCTL
manipulator with me.  I left out code for checking the environment variable
TAPE and using that before the default device - feel free to add it.  And
the commands much match exactly, not just in the first unique prefix.  I
added a few synonyms for some commands, and most drivers do not support
backspace file and backspace record, so pick and choose your commands.  Mt
returns 0 exit status on success, 1 if command unrecognized, and 2 if an
operation failed.  This program requires the sys/mtio.h (or whatever) header
which defines the IOCTL's for your specific driver, but that is copyrighted
and specific for your drivers and system.  Of course, this program won't
help much if you don't have such IOCTL information.


#include <stdio.h>
#include <sys/types.h>
#include <fcntl.h>
#include <sys/mtio.h>

#define	DEF_DEVICE	"/dev/rmt/0"

#define	FAIL	(-1)

struct	mtop	mtop = {-1, 1};

struct	entry {
	int	op;
	char	*name;
}	table[] = {
	{ MTREW,	"rewind"},
	{ MTREW,	"rew"},
	{ MTOFFL,	"offline"},
	{ MTOFFL,	"rewoffl"},
	{ MTWEOF,	"eof"},
	{ MTWEOF,	"weof"},
	{ MTFSF,	"fsf"},
	{ MTFSR,	"fsr"},
	{ MTRETEN,	"reten"},
	{ MTERASE,	"erase"},
	{ MTBSF,	"bsf"},
	{ MTBSR,	"bsr"},
	{ MTNOP,	"nop"}
};

void
usage()
{
	fprintf(stderr, "usage: mt [-f tapename] command count\n");
	exit(1);
}

main(argc, argv)
int	argc;
char	**argv;
{
	int	fd, entries, i;
	char	*devpath, *cmdname;

	if (argc < 2) {
		usage();
	}

	if (strcmp(*++argv, "-f") == 0) {
		switch (argc) {

		  case 4:
			devpath = *++argv;
			cmdname = *++argv;
			break;
		  case 5:
			devpath = *++argv;
			cmdname = *++argv;
			mtop.mt_count = atoi(*++argv);
			break;
		  default:
			usage();
		}
	} else {
		devpath = DEF_DEVICE;

		switch (argc) {

		  case 2:
			cmdname = *argv;
			break;
		  case 3:
			cmdname = *argv;
			mtop.mt_count = atoi(*++argv);
			break;
		  default:
			usage();
		}
	}

	if ((fd=open(devpath, O_RDONLY)) == FAIL) {
		fprintf(stderr, "mt: open failed on %s\n", devpath);
		exit(1);
	}

	entries = sizeof(table)/sizeof(struct entry);
	for ( i=0; i < entries; i++ ) {
		if (strcmp(table[i].name, cmdname) == 0) {
			mtop.mt_op = table[i].op;
			break;
		}
	}
	if (mtop.mt_op == -1) {
		fprintf(stderr, "mt: invalid command %s\n", cmdname);
		exit(1);
	}
	if (ioctl(fd, (int)MTIOCTOP, (caddr_t)&mtop) == FAIL) {
		perror("mt: ");
		exit(2);
	}
	exit(0);
}


-- 
A. Lester Buck     buck@siswat.lonestar.org  ...!texbell!moray!siswat!buck