On 16/05/2009, at 4:32 PM, [email protected] wrote:
From: Daniel Pittman <[email protected]>
Date: 16 May 2009 4:31:34 PM
To: [email protected]
Subject: Re: [SLUG] hot swapping hard drives


Grahame Kelly <[email protected]> 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.

Rather than stating what I suspect is just a "belief", have you look at the Kernel source code at all? If so I would be very interested at exactly where you state such activity happens. According to Linux Internals Doco (and hereijn I refer to the Linux Drivers themselves) Once the device has been "un-mounted" the OS warrants that the device, its linked control blocks, buffers etc. are indeed-flushed and data secured on the device medium. The applicable driver HAVE already unloaded any cache data before the umount command returns with its resultant response.


(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.


Crap controllers are just that - crap ;-)

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. :)

I have never experienced this in all the years working with Linux.
Either you haven't un-mounted the device correctly (that is checked the return status byte if in a script), or the OS release you refer to is/was buggy,


(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.)

Again - read the source code.


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.

It was never mentioned about mounting raw. As everyone should know - your on your own if you mount any device raw, as you become the only one responsible for its connectivity, data control and reliability.


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

Yep every driver should - otherwise they are badly designed and implemented.


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.

Yes but that is my point! - This is all part of the kernel drivers responsibility - read all about this in the source code... and the kernel internals. Hence, there is no need to portray "the overside" of hot swapping as problematic - you put it.

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'

SATA I, II and forthcoming III specifications originally covered hot- swapping. So it would be expected at the hardware level.

Cheers.
Grahame


Regards,
       Daniel



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

--
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