[Top][All Lists]

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

Re: Grub Failure when HDD descriptor changes

From: Molle Bestefich
Subject: Re: Grub Failure when HDD descriptor changes
Date: Tue, 22 Mar 2005 19:41:50 +0100

Peter Jones wrote:
> You *can't* solve this problem on x86.  There is no reliable way to ask
> the bios if it can address a disk, or what ID would have.

Oh, but there is a way.

You could, at boot-up, calculate a md5 hash based on the first sector
of every disk.  If there's a duplicate hash, load the last sector of
every disk also and calculate the md5 based on both.  If there's still
duplicates, add one more sector from the head of the disk.  Continue
till you have completely unique hashes, or, a (user-definable) maximum
number of sectors to traverse has been reached.

When Linux has finished bringing up IDE drivers and device-mapper
devices, scan the disks again.  (The bootloader should probably
include information next to the md5 hashes on how many sectors it had
to scan).  There you go, Linux can easily tell which BIOS disks map to
which Linux disks.  :-).

Another, somewhat kinkier approach, would be to load a kernel module
that took the Big-Kernel-Lock (tm), did a lot of INT 13h'ing to
calculate unique md5 hashes, undid the kernel lock, and went back into
Linux space and did the same through the standard interfaces.

That said, it seems a big solution to a small problem.
It would be much easier to just ask the user how he thinks the disks
are layed out.
If he's in doubt, tell him to go download a GRUB bootdisk and run eg.:
grub> geometry (hd0)
grub> geometry (hd1)
Then go back to Linux, do the same and compare.
Not fool-proof, especially if someone uses multiple disks of the same
size, but it should do.

I'm advocating a bit against the current approach of taking a wild
guess since it decreases the likelihood that anyone will trust GRUB to
modify their MBR (eg. use GRUB ;-)).

But I'd like to know how it's done before I judge it to be completely
insane :-).

Also, whom should I ask if I wanted something to be committed to GRUB CVS?

reply via email to

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