bug-grub
[Top][All Lists]
Advanced

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

Re: Disk mapping confusion with the device command


From: Molle Bestefich
Subject: Re: Disk mapping confusion with the device command
Date: Sat, 12 Nov 2005 22:21:33 +0100

Phillip Susi wrote:
> Molle Bestefich wrote:
> > That's not correct. BIOSs use a variety of LBA<->CHS algorithms, and
> > using the wrong one will cause Grub to load the wrong sectors upon
> > reboot, obviously.

> Hrm... interesting.... I wonder where fdisk got it's numbers then?  And
> where did grub get it's numbers, and why were they different than fdisk?

I suspect that Grub use HDIO_GETGEO, eg. let the kernel take a wild shot.
I think fdisk might take a look at the partition table and use a value
from there, if there are any large placeholders.  Otherwise fallback
to HDIO_GETGEO, otherwise fallback to 255/63.  Only guessing here.

IMHO they both should use HDIO_GETGEO, and the kernel should use EDD
to fill in those values instead of just using 255/63 (which is what I
think it does..).


> There is no rounding error.  This is all integer math.

Hmm, a quick glance at the math would indicate that you're right.
At least if the BIOS chooses to do things properly :-)... Humn.

Nonetheless, it seems that in some cases there are rounding errors.
When using Large translation, for instance:
http://www.win.tue.nl/~aeb/linux/Large-Disk-7.html
Search for "rounding".

Also some disk tools get it wrong (I realize it's not relevant, but anyway):
http://lists.freebsd.org/pipermail/freebsd-bugs/2004-January/005068.html


> This behavior is antiquated and unneccesary,

Antiquated, yes - unnecessary, hell no.  If not for it, half of the
world's partitioning tools would not work with the partitions on your
harddrive.  You would probably have problems with some OSs too.


> which is why I allways change fdisk to sector
> mode and use every last sector.

I've had enough problems with doing so that I don't take that kind of chances.


> I believe dos WILL boot from partitions not cylinder aligned, it just
> creates them cylinder aligned by default.

"MSDOS 6.22 [...] interprets relative starting addresses as if
relative to an aligned address: The starting address of a logical
partition is given relative not to the address of the extended
partition sector that describes it, but relative to the start of the
cylinder that contains that sector. (So, it is not surprising that
also PartitionMagic requires alignment.)"
(Also from the Large Disk HOWTO, section 6.2.)

While it might boot, the above indicates that it's not exactly safe to
use non-aligned partitions.

Regarding Windows, I had a XP system last week which would *just not
boot* no matter what I tried.  Nuking Windows from the partition and
reinstalling didn't work.  Only thing that halp was deleting the
partition and recreating it on a cylinder boundary.  Hmm.


> I believe that NT/2K/XP aligns
> the end of partitions to cylinder bounderies, which is why there is usually
> up to 8 megs of free space at the end of the disk.
> The start of the partition though, it seems to only align to the nearest head.
> If you create a single partition for the whole disk, you end up with a 
> partition
> that starts on sector 63, and ends on the last whole cylinder, leaving any
> partial cylinder beyond that unused.

Interesting!  (And in case anybody wonders, ....... there's the exact
line that defines being a nerd.)

You might be right with the cylinder boundary vs. 8 megs.
There could also be historical reasons:
"Many old IBM PS/2 systems used disks with a defect map written to the
end of the disk."
(Section 6.1 of Large Disk HOWTO.)


> What benefit does not using the last 7.8 MB of the disk provide?  Or maybe
> I'm not understanding you.

Safety precaution in case the BIOS actually does have a rounding error.
Would make sure that no kernel files land there.


> FAT and NTFS boot sectors contain a field called 'hidden sectors' which is
> the absolute sector number of the boot sector.  That number is added to the
> IO that the boot sector does to load the rest of the system.

Interesting..  But what about filesystem IO once the OS is loaded?


> I don't trust partition magic any further than I can throw it.  Of the 4
> times that I have used or seen someone use it, 3 times it completely trashed
> the contents of the disk.  Because of this, I choose to assume that anything
> they do is either wrong or by accident, not something well thought out with
> good reasoning that I simply don't know about.

Really?
I've used it for years with nothing but success.
Even on really obscure systems with 5-6 different OSs (those were the days..).
I've even had a power off during a resize process, after which
Partition Magic actually picked up where it left once I got the system
back up.
I dunno.  Guess our usage patterns differ :-).

(I bet next time you'll tell me that you find LVM to be rock stable ;-))..




reply via email to

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