Re: IDE disk geometry + patch

Peter T. Breuer (
Sat, 5 Dec 1998 12:21:37 +0100 (MET)

Greetings Andries ... thanks for the response.

"A month of sundays ago wrote:"
> But LBA has _always_ been the preferred access mode for linux.
> Are you saying that it is not? Please explain!

> No. This has nothing to do with disk access.

Oops - sorry. I had in mind "preferred mode of setting up the
bios in order that it interact correctly with lilo (and possibly
the kernel boot)."

> It only concerns the geometry returned by the
> HDIO_GETGEO ioctl (as used by fdisk and LILO).

Just so.

> Note that all these numbers are fake and have
> no relation to any hardware parameters.
> The rules of the game are:

As I recall, the rules the last time I read them were a lot more
complex, but may well have boiled down to that. The rules in the linux
(lilo?) docs are very operational, and I have always felt that they were
hiding a simple abstraction. The detailed instructions on what to do
when you have a disk reporting X and it is really Y have always been
almost completely incomprehensible to me. I honestly don't know how
people survived in the eras when they had to follow them or not be able
to boot at all.

> (i) C*H*S is total disk capacity
> (ii) Only change H and S in emergency cases because
> it may confuse other operating systems on the same disk:
> H and S are used in conversions of LBA addresses to 3D addresses.
> The conclusion is that one should always put
> C := capacity/(H*S).

I am glad for that summary. A naive question: if it is that simple,
what IS all that blah blah in the docs about? I've just looked at (Mark
Lord's) doucmentation in ide.txt and failed to understand it again. I
was about to try and summarize it to you! But it escapes my mental
capacity. Here's a randomly chosen quote that may be relevant:

If you cannot use drive translation, *and* your BIOS also restricts you to
entering no more than 1024 cylinders in the geometry field in the CMOS setup,
then just set it to 1024. As of v3.5 of this driver, Linux automatically
determines the *real* number of cylinders for fdisk to use, allowing easy
access to the full disk capacity without having to fiddle around.

You are saying that, no, it doesn't "automatically ...", and that's
because the kernel code fixed things up wrong, and the way to do it
right in the code is to use a separate call to get the total capacity
and then divide by the bios's HS to get C?

I deduce that it is C that we need in the boot code, and not H S, but I
thought we used a different addressing mode, and I don't know if lilo is
going to be happy. Its little boot sector is going to have to run on
its own later at next boot and it's going to have to deal with what the
bios does tell it, not with what we tell it now that the bios should
tell it, if you see what I mean ..

> Andries
> [If you still have these Fujitsus you can check whether
> the change I suggested avoids your complete muddle in
> all cases, regardless of BIOS settings.]

Please send again. As I recall it changed a triple if to something
more simple. I can do it myself, but you might as well send again and
that way I'll get the benefit of your hindsight! (I have no idea where
procmail put your mail .. procmail has a life of its own).


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
Please read the FAQ at