Re: Disk Geometries reported incorrectly on 2.6.0-testX

From: Andries Brouwer
Date: Sun Nov 30 2003 - 08:28:44 EST


On Sun, Nov 30, 2003 at 01:10:36PM +0200, Szakacsits Szabolcs wrote:
>
> On Sun, 30 Nov 2003, Andries Brouwer wrote:
>
> > Just ask yourself this question: does Windows XP require a bootable
> > partition to start below the 1024 cylinder mark?
> > Windows NT4 has such a restriction. Not Windows 2000 or XP.
>
> Wrong:
> http://support.microsoft.com/default.aspx?scid=kb;en-us;282191

"Wrong" - what a pessimism. That URL just confirms what I wrote:
Windows XP has no such restriction. If you explicitly ask Windows XP
to use oldfashioned means, then of course that is your own choice.

> > > > Usually booting goes like this: the BIOS reads sector 0 (the MBR)
> > > > from the first disk, and starts the code found there. What happens
> > > > afterwards is up to that code. If that code uses CHS units to find
> > > > a partition, and if the program that wrote the table has different
> > > > ideas about those units than the BIOS, booting may fail.
> > > Exactly.
> > Good. We agree.
>
> I'm glad also. So what actually [cs]fdisk do with the CHS entries in the
> partition table? Ignore them? Might they convert a given partition start to
> different CHS units if the partition entry was deleted then recreated at
> the same cylinder?

Ha, now we are getting down to business.
*fdisk evolves in time, so the answer is very version dependent.
Let me answer for today's fdisk.

Disk geometry is determined as follows (see fdisk.c:get_geometry())

heads = user_heads ? user_heads :
pt_heads ? pt_heads :
kern_heads ? kern_heads : 255;
sectors = user_sectors ? user_sectors :
pt_sectors ? pt_sectors :
kern_sectors ? kern_sectors : 63;

that is, if the user has specified a geometry on the command line,
then that is what we use; otherwise, if there is a partition
table already and we are able to guess a geometry from that, use that;
otherwise, if the kernel has some idea, use that; finally use */255/63
when no information is available.

Andries

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