[wellylug] USB 3.0 via PCI-e, & SATA HDD enclosures/docks

Ewen McNeill wellylug at ewen.mcneill.gen.nz
Fri Jul 15 09:25:00 NZST 2011


Hi David,

On 2011-07-15 08:09 , David Antliff wrote:
> There is a script called "rescan-scsi-bus.sh" that does something, and
> has a --remove option, but does not seem to actually remove anything.
> I suspect it's meant to be used *after* physically removing a drive,
> although I'm not sure I need it because:

rescan-scsi-bus is a shell script (as implied by the ".sh").  It just 
prods the kernel into looking for SCSI devices at particular locations, 
by basically running through 1..N possible SCSI IDs on a given bus.  If 
run after a new device is plugged in, it can "discover" it and make it 
available.  If run _after_ a device has been removed, it can cause the 
kernel to realise it is gone (although I don't think that's the 
default).  It uses "echo"s like you found.  And looking at the logic in 
the script the "--remove" flag will trigger it to use the 
"remove-single-device" _if_ it doesn't find a pre-existing device any more.

rescan-scsi-bus is really intended for traditional SCSI (I used to use 
it quite a bit 5-10 years ago; and I see the copy I have was written 13 
years ago).  SATA hot plug is something different again (traditional 
SCSI wasn't really hot plug).

https://ata.wiki.kernel.org/index.php/Software_status#Hotplug_support

(which is the site of the libata driver, used for SATA in Linux) implies 
that what you're trying to do is "coldplug" (ie, the disk having been 
spun down, forgotten by the OS, etc first).  Whereas "hotplug" is 
pulling the cable out with less preparation (like, eg, USB).

So my understanding is that you need a controller with hotplug support 
(most of them), and to ensure that everything has been flushed to the 
disk (eg, umount all partitions, remove from md RAID, stop LVM volumes, 
etc), and then to pull the disk out (it should cope with less 
preparation than that, but obviously you could lose data).  Spinning 
down the disk might help from a mechanical point of view, but shouldn't 
affect what the controller thinks of it.

https://ata.wiki.kernel.org/index.php/SATA_hardware_features

lists drivers with hotplug support (most of them now, but several older 
ones have insufficient device features).

Ewen



More information about the wellylug mailing list