Grahame Kelly <grah...@wildpossum.com> writes:

> Of the seven systems I look after, three have hot-swapping HDA's via a
> RAID5/6 drive enclosures, two systems have add-on SATAII caddies for
> hot-swap and the others are without hot-swapping.  If your interested,
> and to reset your angst a little, I have been in the
> computing/engineering industry for 25++ years.
>
> On the software level the OS only has to ensure that all dirty
> (written too) memory pages are written out to the drives and such
> buffering flushed, drive index tables updated and written ALL before
> the drive is removed.

That only handles the hot *UN*-plug side of things, and can cause
significant grief to you if the driver doesn't cope: anything from
several minutes in which *all* disks on that controller are unavailable
during error handling, through to a controller hang.

(Admittedly, the last is only on really bad hardware, but hey, that
 hardware is out there and still within the reasonable life of machines
 for home users.)

Anyway, once the hardware doesn't die completely you still need the
driver stack to notice and remove the now absent hardware from the
software "shadow" representation.

After all, you don't want /dev/sdb hanging about when the disk itself
has been removed, taking up a slot and making life miserable. :)

(Oh, and, of course, the hardware needs to be able to notify the driver
 that the device did actually go away, which not all hardware can.)

> The CLI command "umount" does this within the Linux / Unix OS.

That should have the filesystem flush data, but doesn't actually push
out dirty pages for the device — if you accessed it raw at any point
this will not be sufficient.

(Also, lower layers such as LVM, software RAID, etc, might not flush
 their data during the unmount process.)

> The "sync" command/programming API call is another way to do this
> programmatically.

That will flush raw blocks from the device also.

> That is all that is required.

Those are necessary, but not sufficient, steps, I fear.


Also, on the hotplug side, where a new device is added, your driver
needs to cope with detecting the device addition, probing it and
ensuring the hardware copes, and with reporting that up the software
stack.

> On the hardware side, the PSU socket must ensure that power is
> presented to the drive before logic is connected (ground first). This
> is why the +12v, +5v and GND pins are usually extended about 8mm
> before the rest of the pins are connected.

FWIW, SATA devices are hot-swap and the are ... a little less than 8mm
of coverage for those connections.  Just sayin'

Regards,
        Daniel
--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Reply via email to