Re: Polling SCSI bus


Subject: Re: Polling SCSI bus
From: Timothy A. Seufert (tas@mindspring.com)
Date: Mon Nov 05 2001 - 16:11:31 MST


At 12:15 PM -0700 11/5/01, Charlie Watts wrote:
>On Mon, 5 Nov 2001, nathan r. hruby wrote:
>
>> SCSI *isn't* hot plugable unless you have a array or something designed
>> *specficly* for that purpose. Typically the plugging and unplugging of
>> SCSI devices will have bad effects on the drive and SCSI Host Adaptor. So
>> umm, yes typically you should reboot :)
>
>Hrm. But that's not quite the question. Is it -possible- to force a
>re-scan?

Absolutely. There is no single command to rescan the bus as a whole,
but you can add and remove devices one at a time:

echo "scsi add-single-device A B C D" > /proc/scsi/scsi
echo "scsi remove-single-device A B C D" > /proc/scsi/scsi

A is the host adapter number, B is the channel number, C is the SCSI
ID, D is the LUN (usually 0).

There's also a shell script floating around on the net which uses
this and other /proc entries to rescan all SCSI busses, adding any
new devices and removing old devices no longer present. A google
search for "rescan-scsi-bus.sh" should find it.

>(We used to plug and unplug scsi devices in MacOS all the time - SCSI
>Probe could rescan the bus and it 'just worked'.)
>
>I crossed my fingers every time I did it ...

Two tips for *relatively* safe SCSI hotplug:

1. Never do it when there is any bus activity going on.

2. Try to use correct power sequencing as much as possible. In real
SCSI hotplug systems, the drive's ground connections (both power
ground and logic ground) are connected first and disconnected last.
If the device being plugged in has a different power supply, you also
need to avoid the chance of arcing due to a DC offset between the
power supplies.

For external SCSI devices the best sequence I know of is as follows:
Start with the drive powered off but plugged into the same grounded
AC power strip as the computer, so there's a common AC / chassis
ground. Then plug in the SCSI cable. Then turn on the drive.
Reverse that for sequence for unplug.

For internal devices with a common power supply for the host and
drive, the power cable should be plugged in before attaching the SCSI
cable and removed after detaching the SCSI cable.

If you follow sequencing rules religiously, you PROBABLY won't ever
hurt anything. But there's still a chance, because a real hotplug
system uses special connectors such as SCA which guarantee the
correct sequencing -- with normal SCSI devices you can only
approximate it. And it really ought to be done only with devices and
adapters that are designed to be hotplug tolerant.

-- 
Tim Seufert



This archive was generated by hypermail 2a24 : Mon Nov 05 2001 - 16:23:32 MST