[ale] Is it possible to force Linux to reread a drives gemoetry?

Danny Cox danscox at mindspring.com
Thu Aug 19 17:25:27 EDT 2004


Mike,

On Wed, 2004-08-18 at 07:30, Mike Panetta wrote:
> I am messing around with some (brute force) hot swap, and I can get the swapping done
> and it re reads the ptable correctly if I force it to, but it will not re read the geometry
> which is causing some (maybe harmless) error messages saying its trying to access
> a non existant block when it rereads the partition table.  Does anyone know of a way
> to force linux to re read an IDE drives C,H,S (geometry)?  I have tried all the obvious
> hdparm commands...  I wish it would just do it when a bus reset occured, that would
> make things easy.  Anyone know why this is not done?

	The easy answer: because they didn't have to.

	Seriously, the IDE drivers have 10+ years of cruft in 'em.  When it was
first written, hot-swap obviously wasn't even considered possible (with
IDE).

	In a previous life I got to implement IDE hot swap for the 2.4 kernel. 
We had ACPI tell us when something happened (drive N just
(dis)appeared), and I wrote a routine to handle it via the
ide_register() and ide_unregister() functions.  Since ide_register()
assumes (bad function!) many things (like: the drive is in PIO mode), I
had to make sure that the assumptions were valid.  Specifically, upon
removal, I had to reset the chipset to PIO speed, and such.  Thus, when
ide_register() was called, it was just as if the machine was performing
"drive discovery" during boot, with all that it implies (re-reading the
geometry, partition table, etc.)

	Okay before this becomes a novel or even a short story...whoops!

	If you're masochistic enough to want still more info, feel free to
contact me off-list.

	By the way, the IDE driver is getting a major face-lift from Alan Cox
and Bart (something).  Apparently, Alan is appalled (with two Ps ;-) at
the locking therein, some of which is totally broken, racey, etc.

	There I go again.  Bye!

-- 
kernel, n.: A part of an operating system that preserves the
medieval traditions of sorcery and black art.

Danny



More information about the Ale mailing list