bug-parted
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Disk Geometries reported incorrectly on 2.6.0-testX


From: Patrick J. LoPresti
Subject: Re: Disk Geometries reported incorrectly on 2.6.0-testX
Date: 16 Mar 2004 19:13:35 -0500
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

(Responding to a very old thread, mostly for the archives.  Read the
last paragraph for the most on-topic part.)

I encountered this problem while creating a Linux-based boot disk for
my Windows installation project (http://unattended.sourceforge.net/).
Everything is working now, but this geometry issue was a fairly large
snag.

Let me explain what I am doing.

I boot a diskless Linux system, auto-probe the network hardware and
load the relevant driver, use smbmount to map a Windows share (and
thus gain access to additional tools, scripts, and the Windows
installation media), auto-probe the mass storage hardware and load the
relevant driver, use Parted to partition the disk, run winnt.exe (the
16-bit Windows Setup utility on the Windows CD) under dosemu, and
finally reboot the machine.

As I said, it is all working now, but originally it did not work on
either of my main test systems.  Everything was OK if I booted to DOS
and used DOS fdisk to partition the drive.  But using Parted on a
blank drive failed.  (Emphasis on "blank".  With an existing partition
table, Parted auto-compensates for the disk geometry.)

When I say "failed", I mean that upon the first reboot, I got "NTLDR
not found".  I have no idea why, exactly, but the behavior was quite
consistent: The Windows Setup boot loader, which may or may not be the
same as the usual Windows boot loader, just does not work unless the
partition table uses the "legacy" (INT13/AH=08) BIOS geometry.

This was with both Windows 2000 and Windows XP, by the way.

It took me a while to learn that there is no way to access the legacy
geometry from Linux userspace.  So I wrote one by extending the
information returned by the EDD driver.

The EDD maintainer accepted my patch, with some tweaks:

  http://groups.google.com/groups?threadm=1xXh2-850-17%40gated-at.bofh.it

And it is now part of Linux 2.6.5-rc1.

So now I just do "modprobe edd", and then the legacy values I need are
in /sys/firmware/edd/int13_dev80/{legacy_heads,legacy_sectors}.
(There is also a "legacy_cylinders", but that is uninteresting from a
partition table point of view.)

I read those values, compute a sane cylinder count based on the drive
size, and do

  echo bios_cyl:XX bios_head:YY bios_sect:ZZ > /proc/ide/hda/settings

Then when Parted (or dosemu, for that matter) issues HDIO_GETGEO, it
gets the legacy geometry instead of the "extended" geometry and
everything works.

Because I use /proc/ide/hda/settings, I cannot do anything for non-IDE
devices, so I just ignore this issue and hope for the best.  So far,
it seems to be working for all non-IDE hardware I have seen, but I
would like to do it right.

So, I have two main points.

First, there is definitely such a thing as "geometry" if you want to
share a disk among operating systems.  And the "legacy" geometry
(i.e., the one returned by INT13/AH=08 from the BIOS) is the one you
want to use in your partition table.

Second, I would like a way to force Parted to use a specific geometry.
Right now, I can only do this for IDE devices, and only then because I
can configure the kernel's HDIO_GETGEO values on the fly.  Using
boot-time parameters is unacceptable, because one of the main features
of a Linux boot disk for me is that I can repartition the disk without
reboooting.  Every other Linux partitioning tool allows a user
override for the geometry; I almost switched to using sfdisk over this
issue.  But I think Parted is way cool so I didn't.  Make it a
command-line switch, a Parted command, an environment variable...
Whatever.  Just give me some way to force Parted to use a specific
geometry because "I know what I am doing".

I am willing to code this up if you will provide some guidance about
what you would find acceptable.

Thank you for reading.  And thank you for Parted!

 - Pat




reply via email to

[Prev in Thread] Current Thread [Next in Thread]