IDE "logical" geometry & partition tables (problem with 2.4kerne l, also seems to apply to 2.6)

From: Stuart_Hayes
Date: Tue Oct 21 2003 - 17:03:01 EST



Bart --

I have discovered a problem with how Linux determines IDE disk "logical"
(BIOS) geometry. It only happens under certain unlikely conditions, but I
think it is worthy of attention. Please let me know if you see a problem
with my analysis!

If an IDE hard drive has no partition table when Linux is booted, *and* if
the hard drive is on a PCI IDE controller (a controller that isn't at I/O
address 1f0h), *and* if the drive doesn't support 48-bit addressing, Linux
will just use the geometry that is reported by the drive in with the
"identify device" command, rather than getting the geometry used by the IDE
BIOS by doing an int13 function 8 call. If a partition table is then
created on the drive using this geometry, the CHS values in the partition
table will not be correct.

This will cause the drive not to boot if an MBR is used that does CHS
addressing (rather than LBA addressing)--or if the IDE BIOS doesn't support
the int13 extentions that allow LBA addressing.

If the drive is on an IDE controller that's at 1F0h (like the primary
channel on CSB5/ICH5 south bridge controllers), Linux seems to get the
correct geometry from the BIOS tables (I believe the 2.6 kernel doesn't even
do this). Also, if the drive supports 48-bit addressing, Linux assumes 255
heads/63 sectors, which is probably correct for all PCI IDE controllers.
Or, if the drive has an existing partition table, Linux is typically able to
figure out the correct geometry to use by looking at that table.

I would think that the best solution might be either to use an int13
function 8 call, or assuming 255 heads 63 sectors, if the drive geometry
can't be read from the BIOS table or figured out from an existing partition
table. The geometry reported by the drive itself is almost certain to be
different from the BIOS geometry.

Thanks,
Stuart
stuart_hayes@xxxxxxxx

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/