scsi_device.sh
This script reads /proc/scsi/scsi and for each device it creates a
special file /dev/sg/scd with the
minor number equals the index of the device in /proc/scsi.
This script is neccessary because the linux
/dev/st and
/dev/sg devices can
change dramatically as devices are added to or subtracted from a bus.
It also creates the files:
/dev/st/scd
and
/dev/st/scdn
again with the minor number equaling the
index of the device in /proc/scsi for
the rewind and norewind tape devices.
This script should normally be run at boot time or if the scsi
configuration changes.
Here is an example of the devices created for a robotic tape
library that has four SCSI tape drives, with target ID's
two through five, and a library controller at target ID six.
root [805] > ls -l st sg
sg:
total 0
crw-r--r-- 1 root root 21, 0 Feb 15 10:57 sc0d2
crw-r--r-- 1 root root 21, 1 Feb 15 10:57 sc0d3
crw-r--r-- 1 root root 21, 2 Feb 15 10:57 sc0d4
crw-r--r-- 1 root root 21, 3 Feb 15 10:57 sc0d5
crw-r--r-- 1 root root 21, 4 Feb 15 10:57 sc0d6
st:
total 0
crw-r--r-- 1 root root 9, 0 Feb 15 10:57 sc0d2
crw-r--r-- 1 root root 9, 128 Feb 15 10:57 sc0d2n
crw-r--r-- 1 root root 9, 1 Feb 15 10:57 sc0d3
crw-r--r-- 1 root root 9, 129 Feb 15 10:57 sc0d3n
crw-r--r-- 1 root root 9, 2 Feb 15 10:57 sc0d4
crw-r--r-- 1 root root 9, 130 Feb 15 10:57 sc0d4n
crw-r--r-- 1 root root 9, 3 Feb 15 10:57 sc0d5
crw-r--r-- 1 root root 9, 131 Feb 15 10:57 sc0d5n
I know this is based on something I saw on the web, somewhere,
but I don't have any notes telling me where. However, I pretty
much rewrote the whole thing to meet my desires. So, feel free to
use it anyway you want.
varyon.sh
varyoff.sh
The two other scripts do just what their names imply. The assumption is
that the tape device has a SCSI target ID of 4. Again, they came from
the net somewhere, so I can't take credit for them, but the author left
no bread crumbs in the file. But, then again, I didn't leave any in
there either.