Comment 16 for bug 225175

Revision history for this message
Francesco Pretto (ceztko) wrote : Re: [Bug 225175] Re: S-ATA Hard drives swapped

2008/7/24 Scott James Remnant <email address hidden>:
> Nothing has changed in udev

Maybe not in udev, but something has to be changed.

Ubuntu 7.10: *always* correct bios ordering;
Gentoo 2008.0 (kernel 2.6.24, udev 115): *always* correct bios ordering;

Ubuntu 8.04.01: *always* SWAPPED ordering;

Where *always* is "in all my attempts".

I'm not saying it's not a lecit change, but please identify when this
behavior changed.

>
> The relationship with grub is only a perceived one.
>
> In fact, grub has no matching or intelligence between sdX drives and its
> own designators. This is the reason it uses its own in the first place.
> Grub's device ordering depends entirely on the BIOS view of the drives,
> in particular this means grub does not see any drive not seen by the
> BIOS.
>

Let's make this important distinction:
1) Grub as a mbr: let's call it grub-mbr;
2) Grub as a shell frontend: let's call it /sbin/grub.

grub-mbr obviously use bios, and after an install of ubuntu 8.04, the
detected ordering of grub at boot is always "correct" (the bios one).

/sbin/grub on livecd 8.04 gets different ordering, clearly not the
bios one. So, I'm assuming that /sbin/grub is NOT using bios for its
probes. It may use the current device files, but it's just my guess.
We should ask this to grub maintainers (if they are listening...).

You pointed:

> Grub has its own issues as well; a favourite bug report is that grub
> changes *its* device ordering when adding or removing drives, for no
> readily apparent reason. (On my own machine, a new SATA drive on port 3
> became hd0 shuffling up those on ports 0-2)
>
> ...
>
> Switching grub to UUIDs solves both sets of problems.
>

1) To make this working, grub-mbr must itself use UUIDs, not only
/sbin/grub. In this way, even in grub.com/menu.lst you'll have root
directives with UUIDs, for example "root
(f0f68b8c-cf26-4c76-8a21-6a5c02c028dd)" instead of "root (hd0,0)". If
this is not already implemented, it will require major changes to
grub.
2) Not fully true. Switching to UUIDs won't solve the problem of
finding the drive bios will boot (read where to install grub-mbr). I
know, this problem is unsolvable in all the cases: people may want to
boot from a SCSI drive even if they have an ATA drive, and grub can't
say which is the preferred drive. However, we have to offer a
"sensible default": relying on bios ordering and choosing the first
hard disk is, IMHO, a good one in case of not so complicated
configurations. Distros worked this way from the beginning, and nobody
ever complained. If, for some reason, /sbin/grub is unable to detect
bios ordering, this is a major problem and will breaks many
configurations with >= 2 hard disks.

> The only mapping between sdX and hdN names is /boot/grub/device.map
> which is attempted to be kept in sync, but can fail between reboots.

device.map is used only by /sbin/grub when you are using the switch
--device-map. Changes on this file won't reflect to grub-mbr unless
you re-install it from /sbin/grub using the command "setup (hdX)". So,
simply keeping it synced correctly won't solve the problem either.