bug-parted
[Top][All Lists]
Advanced

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

Re: Parted gets wrong geometry, hangs writing filesystem


From: Andrew Clausen
Subject: Re: Parted gets wrong geometry, hangs writing filesystem
Date: Sat, 05 May 2001 09:10:30 +1000

Peter Sherwood wrote:
> At 08:09 AM 5/4/01 , you wrote:
> >> Now I attempted to restore the swap partition by giving the command
> >> "mkpartfs logical linux-swap 31220.099 32247.663".
> >> Parted hangs with the disk activity light on.
> >
> >I bet it didn't hang... it was checking the disk for defects. (You want to
> do this for swap! ;-)
> 
> Possible, but unlikely. I waited several minutes, and there was no sound
> from disk. Also LILO hangs in the same way on some boots.

In that case, it's a Linux bug, and not a Parted bug.
It sounds like some Linux people might be interested...

> >There is no reliable way of communicating CHS values from the BIOS to
> Linux, unfortunately :-(
> 
> I do not believe a running program is unable to ascertain the disk
> parameters.

It is, because:
(a) CHS are not disk parameters.  They are BIOS parameters
associated with the disk
(b) the BIOS has no reliable way of communicating it, because
it doesn't have a reliable way to communicate WHICH hard disk
it is talking about.

> The disk itself will provide them upon the proper inquiry.

Incorrect.  It is a BIOS abstraction.

However, the disk itself will provide the SIZE of the disk.

> And fdisk does it right.

The reason for this is: the geometry is calculated like this:

* heads and sectors are guessed from BIOS stuff, and where
partitions start & end, etc.

* cylinders == [size of disk - obtained from disk directly]
                / (heads * sectors)

So, Parted, Linux and fdisk are getting the heads and sectors
right.  Parted is getting the size of the disk from Linux...
so it isn't a Parted bug.

> EZ-BIOS also does it right.

Of course it does!  If EZ-BIOS says the number of heads ==
the phase of the moon, then that's right.  It is by definition!

> And, incidentally, I built
> parted 1.14.11 and ran it on the mounted device (i e, while normal Linux
> was running), just to print out the partitions, and it said 7473/255/63.

Aha.  So that explains everything... the kernel on the Parted
boot disk is broken.
 
> Speaking as someone who has written many disk drivers, I don't understand
> why there are all the problems about the disk geometry. We use LBA for
> almost all purposes, but for optimization is it sometimes useful to know
> the physical geometry of the disk, and that is available from the disk
> itself. The kludges that PC/BIOS designers went through to compensate for
> lack of foresight is assigning enough disk address bits do not matter. Am I
> missing something?

It isn't a problem for Linux.  It's just that in the past, all
IO communication was done via CHS addressing.  The BIOS provides
no reliable way of finding out the CHS geometry, so this can cause
problems when trying to install lilo (from Linux) using CHS
addressing.  Also, MS operating systems often use CHS.  Also, they
(and many tools) expect partitions to be aligned to cylinder
boundaries, etc.

So, for Linux itself, CHS is irrelevant.  It's just compatibility
with other stuff.

> Now we come to part II: I need to fix my partitions. I'm trying to use
> parted to do so, but I need to get it running in "7473 cyl" mode. I don't
> understand how to produce a boot image file, and I haven't yet located the
> algorithm by which parted determines the disk geometry. I downloaded the
> boot disk image a few days ago, so I'm using the latest version, but I
> don't know if that corresponds to 1.14.11. Maybe you can help with these
> questions.

Even if Parted believed the disk was bigger (when run from the boot
disk), it wouldn't be able to write after the size that Linux
believes.

(BTW: you can test this whole theory via "cat /proc/partitions"...
run it from your normal Linux setup, and from the boot disk.
I bet the output from the boot disk will show a smaller disk.
If not, we're looking for another problem!)

You could use Kent Robitti's mkparted script, for making parted
boot disks (I intend to include them in parted... just I haven't
had enough time to clean them up properly).  Another option would
be to copy the parted binary onto a floppy, and find another
boot disk (eg: from your distribution's installer)... this
is described in more detail in section 1.5 of the manual.

> Another comment: When I configure and make, I get a large number of
> warnings, some of which should be fixed if you want the software to be
> truly portable (e g, you can't assume sizeof(int)=sizeof(*void)), and the
> remainder should be fixed so users don't have to worry about them.

Funny you should mention it... we have just fixed everything,
so there are no warnings.  I have added CFLAGS=-Werror ;-)

Thanks!
Andrew Clausen



reply via email to

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