Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 20 Mar 1995 23:39:28 -0800 (PST)
From:      julian@tfs.com (Julian Elischer)
To:        phk@ref.tfs.com (Poul-Henning Kamp)
Cc:        fbsd@clem.systemsix.com, hackers@FreeBSD.org, moto@CS.cmu.edu, tinguely@plains.nodak.edu
Subject:   Re: Problems with 2940 and 950210snap
Message-ID:  <m0rqyXJ-0003wOC@TFS.COM>
In-Reply-To: <199503210550.VAA29551@ref.tfs.com> from "Poul-Henning Kamp" at Mar 20, 95 09:50:47 pm

next in thread | previous in thread | raw e-mail | index | archive | help
> 
> > 	I am closing in on the "restore ..." panics with 4mm DAT
> > drives.
> > 
> > Summary:
> > 
> > without specific option dump writes (10 * 1024) byte records to
> > tape while restore attempts to read (32 * 1024) byte records from
> > tape.  It is something about this read that appears to panic the
> > kernel.
> > 
> 
> Could you try to use "tcopy /dev/rmt0" to verify the blocksize ?

if we distributed the 'st' utility like we should,
you could run

st -f /dev/nrst0  status

and we could see the mode the device was operating in.
that would tell us a lot about the possible causes..
then you can use the scsi(1) or is that scsi(8) command
to turn on debugging on the tape
and see what it's being asked to do.....
scsi(8) is in current,
I include st(1) here so you can try it out
it should be in the source tree (next to mt(1)) but appears to be missing..

to  use the SCSI debugging you need the kernel option SCSIDEBUG.
you would then run 

scsi -f /dev/st0ctl.0 -d 15

(and stand back.. there'll be a lot of debug info..)


# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	st
#	st/Makefile
#	st/st.1
#	st/st.c
#
echo c - st
mkdir -p st > /dev/null 2>&1
echo x - st/Makefile
sed 's/^X//' >st/Makefile << 'END-of-st/Makefile'
X#	$Id: Makefile,v 1.2 1993/11/18 05:05:39 rgrimes Exp $
X
XPROG=	st
XMAN1=   st.1
X
X.include <bsd.prog.mk>
END-of-st/Makefile
echo x - st/st.1
sed 's/^X//' >st/st.1 << 'END-of-st/st.1'
X.\" Copyright (c) 1981, 1990 The Regents of the University of California.
X.\" All rights reserved.
X.\"
X.\"
X.\" Redistribution and use in source and binary forms, with or without
X.\" modification, are permitted provided that the following conditions
X.\" are met:
X.\" 1. Redistributions of source code must retain the above copyright
X.\"    notice, this list of conditions and the following disclaimer.
X.\" 2. Redistributions in binary form must reproduce the above copyright
X.\"    notice, this list of conditions and the following disclaimer in the
X.\"    documentation and/or other materials provided with the distribution.
X.\" 3. All advertising materials mentioning features or use of this software
X.\"    must display the following acknowledgement:
X.\"	This product includes software developed by the University of
X.\"	California, Berkeley and its contributors.
X.\" 4. Neither the name of the University nor the names of its contributors
X.\"    may be used to endorse or promote products derived from this software
X.\"    without specific prior written permission.
X.\"
X.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
X.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
X.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
X.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
X.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
X.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
X.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
X.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
X.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
X.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
X.\" SUCH DAMAGE.
X.\"
X.\"	@(#)mt.1	6.7 (Berkeley) 7/28/91
X.\"
X.Dd July 28, 1991
X.Dt ST 1
X.Os BSD 4
X.Sh NAME
X.Nm st
X.Nd magnetic tape manipulating program
X.Sh SYNOPSIS
X.Nm st
X.Op Fl f Ar tapename
X.Ar command
X.Op Ar count
X.Sh DESCRIPTION
X.Nm St
Xis used to give commands to a magnetic tape drive.
XBy default
X.Nm st
Xperforms the requested operation once.  Operations
Xmay be performed multiple times by specifying
X.Ar count  .
XNote
Xthat
X.Ar tapename
Xmust reference a raw (not block) tape device.
X.Pp
XThe tape drive will hold density and blocking parameters until the next 
Xunmount. In the case of rst0, this is immediately and is therefore of
Xnot much use with this device. In the case of nrst0 this
Xmay be after several commands when either an offline command is issued or
Xrst0 is openned and closed. If parameters are to be held across 
Xunmounts, then they should be made to the control device for each
Xmode.. i.e. the devices with a submode of 3 (minors 3,7,11,15 for example).
XIt is suggested that the operator keep the control device unreadble
Xand unwritable to normal system users, while giving them access to
Xthe non-rewind device (e.g. nrst0) on demand.
X.Pp
XThe available commands are listed below.  Only as many
Xcharacters as are required to uniquely identify a command
Xneed be specified.
X.Bl -tag -width "eof, weof"
X.It Cm eof , weof
XWrite
X.Ar count
Xend-of-file marks at the current position on the tape.
X.It Cm fsf
XForward space
X.Ar count
Xfiles.
X.It Cm fsr
XForward space
X.Ar count
Xrecords.
X.It Cm bsf
XBack space
X.Ar count
Xfiles.
X.It Cm bsr
XBack space
X.Ar count
Xrecords.
X.It Cm compress
XSet compression for the mode to type
X.Ar comp
Xwhere 0 is off and 1 is default.
X.It Cm rewind
XRewind the tape
X(Count is ignored).
X.It Cm offline , rewoffl
XRewind the tape and place the tape unit off-line (possibly eject)
X(Count is ignored).
X.It Cm blocksize
XSets the block size characteristics of the openned 
Xdevice to value specified in
X.Ar count.
XA 0 means variable sized blocks, and anything else means fixed block, 
Xwith blocksize as that of
X.Ar count.
X.It Cm density
XSet the density for the openned device  (bits 2,3 of minor number)
X.Ar count
Xdensity code as specified by the SCSI II specification. Valid values
Xare from 0  to 0x17.
X.It The different density codes are as follows:
X0x0	default for device
X.br
X0xE	reserved for ECMA
X.br
X
XValue Tracks Density(bpi) Code Type  Reference     Note
X.br
X0x1     9       800       NRZI  R    X3.22-1983    2
X.br
X0x2     9      1600       PE    R    X3.39-1986    2
X.br
X0x3     9      6250       GCR   R    X3.54-1986    2
X.br
X0x5    4/9     8000       GCR   C    X3.136-1986   1
X.br
X0x6     9      3200       PE    R    X3.157-1987   2
X.br
X0x7     4      6400       IMFM  C    X3.116-1986   1
X.br
X0x8     4      8000       GCR   CS   X3.158-1986   1
X.br
X0x9    18     37871       GCR   C    X3B5/87-099   2
X.br
X0xA    22      6667       MFM   C    X3B5/86-199   1
X.br
X0xB     4      1600       PE    C    X3.56-1986    1
X.br
X0xC    24     12690       GCR   C    HI-TC1        1,5
X.br
X0xD    24     25380       GCR   C    HI-TC2        1,5
X.br
X0xF    15     10000       GCR   C    QIC-120       1,5
X.br
X0x10   18     10000       GCR   C    QIC-150       1,5
X.br
X0x11   26     16000       GCR   C    QIC-320(525?) 1,5
X.br
X0x12   30     51667       RLL   C    QIC-1350      1,5
X.br
X0x13    1     61000       DDS   CS    X3B5/88-185A 4
X.br
X0x14    1     43245       RLL   CS    X3.202-1991  4
X.br
X0x15    1     45434       RLL   CS    ECMA TC17    4
X.br
X0x16   48     10000       MFM   C     X3.193-1990  1
X.br
X0x17   48     42500       MFM   C     X3B5/91-174  1
X.br
X
Xwhere Code means:
X.br
XNRZI	Non Return to Zero, change on ones
X.br
XGCR	Group Code Recording
X.br
XPE	Phase Encoded
X.br
XIMFM	Inverted Modified Frequency Modulation
X.br
XMFM	Modified Frequency Modulation
X.br
XDDS	Dat Data Storage
X.br
XRLL	Run Length Encoding
X.br
X
Xwhere Type means:
X.br
XR	Real-to-Real
X.br
XC	Cartridge
X.br
XCS	cassette
X.br
X
Xwhere Notes means:
X.br
X1	Serial Recorded
X.br
X2	Parallel Recorded
X.br
X3	Old format know as QIC-11
X.br
X4	Helical Scan
X.br
X5	Not ANSI standard, rather industry standard.
X.br
X
X.It Cm status
XPrint status information about the tape unit.
XInformation is printed out about the present active parameters and
Xalso the four Operating modes available.
X.El
X.Pp
XIf a tape name is not specified, and the environment variable
X.Ev TAPE
Xdoes not exist;
X.Nm st
Xuses the device
X.Pa /dev/nrst0 .
X.Pp
X.Nm St
Xreturns a 0 exit status when the operation(s) were successful,
X1 if the command was unrecognized, and 2 if an operation failed.
X.Sh ENVIRONMENT
XIf the following environment variable exists, it is utilized by
X.Nm st .
X.Bl -tag -width Fl
X.It Ev TAPE
X.Nm St
Xchecks the
X.Ev TAPE
Xenvironment variable if the
Xargument
X.Ar tapename
Xis not given.
X.Sh FILES
X.Bl -tag -width /dev/rmt* -compact
X.It Pa /dev/rst*
XRaw magnetic tape interface
X.El
X.Sh SEE ALSO
X.\".Xr mtio 4 ,
X.Xr st 4 ,
X.Xr dd 1 ,
X.Xr ioctl 2 ,
X.Xr environ 7
X.Sh HISTORY
XThe
X.Nm st
Xcommand appeared in 386BSD 0.1.
XIt is derived from 
X.Xr mt 8
Xand will eventually re-merge with it.
X
X.\" mt.1: mtio(4) missing
END-of-st/st.1
echo x - st/st.c
sed 's/^X//' >st/st.c << 'END-of-st/st.c'
X/*
X * Copyright (c) 1980 The Regents of the University of California.
X * All rights reserved.
X *
X * Redistribution and use in source and binary forms, with or without
X * modification, are permitted provided that the following conditions
X * are met:
X * 1. Redistributions of source code must retain the above copyright
X *    notice, this list of conditions and the following disclaimer.
X * 2. Redistributions in binary form must reproduce the above copyright
X *    notice, this list of conditions and the following disclaimer in the
X *    documentation and/or other materials provided with the distribution.
X * 3. All advertising materials mentioning features or use of this software
X *    must display the following acknowledgement:
X *	This product includes software developed by the University of
X *	California, Berkeley and its contributors.
X * 4. Neither the name of the University nor the names of its contributors
X *    may be used to endorse or promote products derived from this software
X *    without specific prior written permission.
X *
X * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
X * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
X * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
X * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
X * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
X * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
X * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
X * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
X * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
X * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
X * SUCH DAMAGE.
X */
X
X#ifndef lint
Xchar copyright[] =
X"@(#) Copyright (c) 1980 The Regents of the University of California.\n\
X All rights reserved.\n";
X#endif /* not lint */
X
X#ifndef lint
Xstatic char sccsid[] = "@(#)mt.c	5.6 (Berkeley) 6/6/91";
X#endif /* not lint */
X
X/*
X * mt --
X *   magnetic tape manipulation program
X */
X#include <sys/types.h>
X#include <sys/ioctl.h>
X#include <sys/mtio.h>
X#include <fcntl.h>
X#include <stdio.h>
X#include <ctype.h>
X
X#define	equal(s1,s2)	(strcmp(s1, s2) == 0)
X
Xstruct commands {
X	char *c_name;
X	int c_code;
X	int c_ronly;
X} com[] = {
X	{ "weof",	MTWEOF,	0 },
X	{ "eof",	MTWEOF,	0 },
X	{ "fsf",	MTFSF,	1 },
X	{ "bsf",	MTBSF,	1 },
X	{ "fsr",	MTFSR,	1 },
X	{ "bsr",	MTBSR,	1 },
X	{ "rewind",	MTREW,	1 },
X	{ "offline",	MTOFFL,	1 },
X	{ "rewoffl",	MTOFFL,	1 },
X	{ "status",	MTNOP,	1 },
X	{ "blocksize",	MTSETBSIZ,	0 },
X	{ "density",	MTSETDNSTY,	0 },
X	{ 0 }
X};
X
Xint mtfd;
Xstruct mtop mt_com;
Xstruct mtget mt_status;
Xchar *tape;
X
Xmain(argc, argv)
X	char **argv;
X{
X	void usage();
X	char line[80], *getenv();
X	register char *cp;
X	register struct commands *comp;
X
X	if (argc > 2 && (equal(argv[1], "-t") || equal(argv[1], "-f"))) {
X		argc -= 2;
X		tape = argv[2];
X		argv += 2;
X	} else
X		if ((tape = getenv("TAPE")) == NULL)
X			tape = DEFTAPE;
X	if (argc < 2) {
X		usage();
X		exit(1);
X	}
X	cp = argv[1];
X	if ((strncmp(cp, "blocksize", strlen(cp)) == 0) && argc < 3 ) {
X		usage();
X		exit(1);
X	}
X	if ((strncmp(cp, "density", strlen(cp)) == 0) && argc < 3 ) {
X		usage();
X		exit(1);
X	}
X	for (comp = com; comp->c_name != NULL; comp++)
X		if (strncmp(cp, comp->c_name, strlen(cp)) == 0)
X			break;
X	if (comp->c_name == NULL) {
X		fprintf(stderr, "st: don't grok \"%s\"\n", cp);
X		usage();
X		exit(1);
X	}
X	if ((mtfd = open(tape, comp->c_ronly ? O_RDONLY : O_RDWR)) < 0) {
X		perror(tape);
X		exit(1);
X	}
X	if (comp->c_code != MTNOP) {
X		mt_com.mt_op = comp->c_code;
X		mt_com.mt_count = (argc > 2 ? atoi(argv[2]) : 1);
X		if (mt_com.mt_count < 0) {
X			fprintf(stderr, "st: negative repeat count\n");
X			exit(1);
X		}
X		if (ioctl(mtfd, MTIOCTOP, &mt_com) < 0) {
X			fprintf(stderr, "%s %s %d ", tape, comp->c_name,
X				mt_com.mt_count);
X			perror("failed");
X			exit(2);
X		}
X	} else {
X		if (ioctl(mtfd, MTIOCGET, (char *)&mt_status) < 0) {
X			perror("st");
X			exit(2);
X		}
X		status(&mt_status);
X	}
X}
X
X#ifdef vax
X#include <vaxmba/mtreg.h>
X#include <vaxmba/htreg.h>
X
X#include <vaxuba/utreg.h>
X#include <vaxuba/tmreg.h>
X#undef b_repcnt		/* argh */
X#include <vaxuba/tsreg.h>
X#endif
X
X#ifdef sun
X#include <sundev/tmreg.h>
X#include <sundev/arreg.h>
X#endif
X
X#ifdef tahoe
X#include <tahoe/vba/cyreg.h>
X#endif
X
Xstruct tape_desc {
X	short	t_type;		/* type of magtape device */
X	char	*t_name;	/* printing name */
X	char	*t_dsbits;	/* "drive status" register */
X	char	*t_erbits;	/* "error" register */
X} tapes[] = {
X#ifdef vax
X	{ MT_ISTS,	"ts11",		0,		TSXS0_BITS },
X	{ MT_ISHT,	"tm03",		HTDS_BITS,	HTER_BITS },
X	{ MT_ISTM,	"tm11",		0,		TMER_BITS },
X	{ MT_ISMT,	"tu78",		MTDS_BITS,	0 },
X	{ MT_ISUT,	"tu45",		UTDS_BITS,	UTER_BITS },
X#endif
X#if defined(sun) 
X	{ MT_ISCPC,	"TapeMaster",	TMS_BITS,	0 },
X	{ MT_ISAR,	"Archive",	ARCH_CTRL_BITS,	ARCH_BITS },
X#endif
X#ifdef tahoe
X	{ MT_ISCY,	"cipher",	CYS_BITS,	CYCW_BITS },
X#endif
X#if  defined (__386BSD__) 
X	{ MT_ISAR,	"Archive/Tandberg?",	0,	0 },
X#endif
X	{ 0 }
X};
X
X/*
X * Interpret the status buffer returned
X */
Xstatus(bp)
X	register struct mtget *bp;
X{
X	register struct tape_desc *mt;
X
X	printf("Present Mode:	Density = 0x%02x, Blocksize = %d bytes\n",
X		bp->mt_density, bp->mt_blksiz);
X	printf("---------available modes----------\n");
X	printf("Mode 0:		Density = 0x%02x, Blocksize = %d bytes\n",
X		bp->mt_density0, bp->mt_blksiz0);
X	printf("Mode 1:		Density = 0x%02x, Blocksize = %d bytes\n",
X		bp->mt_density1, bp->mt_blksiz1);
X	printf("Mode 2:		Density = 0x%02x, Blocksize = %d bytes\n",
X		bp->mt_density2, bp->mt_blksiz2);
X	printf("Mode 3:		Density = 0x%02x, Blocksize = %d bytes\n",
X		bp->mt_density3, bp->mt_blksiz3);
X		
X#ifdef NOTYET
X	printf("tape drive: residual=%d\n", 
X		 bp->mt_resid);
X	printreg("ds", bp->mt_dsreg, mt->t_dsbits);
X	printreg("\ner", bp->mt_erreg, mt->t_erbits);
X	putchar('\n');
X#endif
X}
X
X/*
X * Print a register a la the %b format of the kernel's printf
X */
Xprintreg(s, v, bits)
X	char *s;
X	register char *bits;
X	register unsigned short v;
X{
X	register int i, any = 0;
X	register char c;
X
X	if (bits && *bits == 8)
X		printf("%s=%o", s, v);
X	else
X		printf("%s=%x", s, v);
X	bits++;
X	if (v && bits) {
X		putchar('<');
X		while (i = *bits++) {
X			if (v & (1 << (i-1))) {
X				if (any)
X					putchar(',');
X				any = 1;
X				for (; (c = *bits) > 32; bits++)
X					putchar(c);
X			} else
X				for (; *bits > 32; bits++)
X					;
X		}
X		putchar('>');
X	}
X}
Xvoid usage() {
X	register struct commands *comp;
X
X	fprintf(stderr, "Usage: st [ -f tape ] command [ count ] \n");
X	fprintf(stderr, "	Where command is one of:\n");
X	for (comp=com; comp->c_name != NULL; comp++) {
X		fprintf(stderr, "	%s\n", comp->c_name);
X	}
X	fprintf(stderr,"Note that the count argument is required\n");
X	fprintf(stderr, "with the \"blocksize\" , and the density setting commands.\n");
X	fprintf(stderr, "Note that the count argument is a base 10 number\n");
X}
END-of-st/st.c
exit




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?m0rqyXJ-0003wOC>