Re: SCSI Tape driver

Richard B. Johnson (root@chaos.analogic.com)
Thu, 18 Sep 1997 12:23:40 -0400 (EDT)


On Thu, 18 Sep 1997, Michael Stone wrote:

> Quoting Richard B. Johnson (root@chaos.analogic.com):
> > The SCSI tape devices have a major and minor number. If you want the tape
> > to stay where it was after using 'mt', you use the device with the minor
> > number's high-bit set.
> >
> > /dev/st0 9, 0
> > /dev/st1 9, 1
> > /dev/st3 9, 128
> > /dev/st4 9, 129
> >
> > In this case /dev/st0 and /dev/st3 refer to the exact same drive. If
> > you are using commands that require the state of the tape-drive to
> > remain unchanged, you use /dev/st3. If you want the tape to rewind or,
> > if supported unload, you use /dev/st0.
>
> Hmm. In my copy of devices.txt, it says this:
>
> 9 char SCSI tape devices
> 0 = /dev/st0 First SCSI tape, mode 0
> 1 = /dev/st1 Second SCSI tape, mode 0
> ...
> 32 = /dev/st0l First SCSI tape, mode 1
> 33 = /dev/st1l Second SCSI tape, mode 1
> ...
> 64 = /dev/st0m First SCSI tape, mode 2
> 65 = /dev/st1m Second SCSI tape, mode 2
> ...
> 96 = /dev/st0a First SCSI tape, mode 3
> 97 = /dev/st1a Second SCSI tape, mode 3
> ...
> 128 = /dev/nst0 First SCSI tape, mode 0, no rewind
> 129 = /dev/nst1 Second SCSI tape, mode 0, no rewind
> ...
> 160 = /dev/nst0l First SCSI tape, mode 1, no rewind
> 161 = /dev/nst1l Second SCSI tape, mode 1, no rewind
> ...
> 192 = /dev/nst0m First SCSI tape, mode 2, no rewind
> 193 = /dev/nst1m Second SCSI tape, mode 2, no rewind
> ...
> 224 = /dev/nst0a First SCSI tape, mode 3, no rewind
> 225 = /dev/nst1a Second SCSI tape, mode 3, no rewind
>
> Which would seem to imply that the prefix 'n' indicates a device
> which doesn't automatically rewind. The method you suggested would
> cause serious problems for someone who wanted to use multiple tape
> drives.

Not true. The __NAME__ of the drive is completely and positively
unimportant. Only the major/minor device numbers are of any consequence.
This is what the kernel code uses to determine what it is, and how to
handle it.

In my case, I did not have a bunch of device names created to look like
a Sun as is often done by vendors who provide Linux distributions. My
systems were not built that way. If you look in the list you provide,
you will note that your device major/minor numbers follow exactly as
I stated.

You can make a device using mknod with any name you chose....

Usage: mknod [OPTION]... PATH TYPE [MAJOR MINOR]

-m, --mode=MODE set permission mode (as in chmod), not 0666 - umask
--help display this help and exit
--version output version information and exit

MAJOR MINOR are forbidden for TYPE p, mandatory otherwise. TYPE may be:

b create a block (buffered) special file
c, u create a character (unbuffered) special file
p create a FIFO

If it has the proper major/minor device numbers, it will access your
tape. If the high bit of the minor device number is set, the tape
will not rewind between commands. Note these numbers are 8 bits in
length.

# mknod /dev/funny_tape_drive_name_do_rewind c 9 0
# mknod /dev/funny_tape_drive_name_no_rewind c 9 128

These 'devices' don't even have to be in /dev. You can make them
in /tmp if you wish. As I stated the names mean nothing.

Cheers,
DJ
Richard B. Johnson
Analogic Corporation
Penguin : Linux version 2.1.54 on an i586 machine (66.15 BogoMips).
Warning : It's hard to stay on the trailing edge of technology.
Linux : Engineering tool
Windows : Child's computer interface written in BASIC.
Win-NT : Child's computer interface rewritten in C.