Re: [RFC] Restoring HDIO_GETGEO semantics (was: Re: workaround for BIOS / CHS stuff)

Patrick J. LoPresti
2004-07-03T14:15:50Z

Andrew Clausen <clausen@gnu.org> writes:

> > > Parted needs a mechanism to let me FORCE the geometry it uses.
> > > Every other partitioning tool has this, usually via command-line
> > > switch.
>
> Would this solve any problems? The people who get hit aren't going
> to use the switch, right?

You are thinking of Parted as an end-user tool. But there are 1000
times as many people using Parted without even knowing it, every time
they install Linux.

Parted is primarily a component of larger systems; namely, the
RedHat/Suse/etc. installers. Those larger systems can figure out the
correct geometry (using whatever logic/heuristics/knowledge they have)
and pass it to the tools which need it, of which Parted is just one.

In my case, my software *knows* the geometry because it got it from
/sys/firware/edd. Right now, I use a hack (/proc/ide/hda/settings) to
override the values returned by HDIO_GETGEO. I run Parted once to
blow away the partition table, then run it again. With no partition
table to help it "guess", Parted falls back on the HDIO_GETGEO values,
thus using the geometry I specify.

It works, but I would rather just pass the geometry to Parted when I
run it.

I am suggesting that you cater to the 99.9% case. This means
providing some way, any way, to override Parted's notion of the
geometry. In my opinion, you should simply gut the logic for guessing
the geometry, because it really does not belong in Parted. But I do
not really care as long as I have a way to bypass it.

(Note that this would also provide a way for end users to fix their
partition tables if/when they broke. Right now, the stock solution
for disks which Parted "broke" is "sfdisk -d | sfdisk -C# -H# -S#".
Wouldn't it be nice if people could use Parted instead?)

> > 1) and 2) need a way to get a "sane" geometry from the BIOS or kernel.
>
> Shouldn't we just use LBA? (i.e. x/255/63)

IBM Thinkpads use x/240/63. In theory, other BIOSes could use
anything.

But x/255/63 is usually a better guess than HDIO_GETGEO. Except in my
application, which I could fix if Parted had command-line options to
specify the geometry.

- Pat