[wellylug] USB 3.0 via PCI-e, & SATA HDD enclosures/docks
David Antliff
david.antliff at gmail.com
Fri Jul 15 09:48:44 NZST 2011
On Fri, Jul 15, 2011 at 09:25, Ewen McNeill wrote:
> 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).
Hi Ewen,
Thank you for your insight - perhaps I am being over-cautious with the
spin-down, although I noticed that there's an audible and slightly
disconcerting mechanical "clunk" when I 'hot-unplug' the drive, so I
thought that spinning it down might be a better long-term approach.
All of this will eventually run via a script, so I'll probably retain
the slightly more involved 'cold plug' unless someone can tell me that
it's detrimental in some way :)
On a related subject, I recently learned that newer HDDs need
partitions aligned to 4 KB boundaries, and that fdisk does not do that
by default. The result is a poorly performing drive. If anyone is
interested, this may help explain: http://www.sfnomad.com/?p=68
-- David.
-- David.
More information about the wellylug
mailing list