Mailinglist Archive: opensuse (1660 mails)

< Previous Next >
Re: [opensuse] disk device names and libata
  • From: "Brian K. White" <brian@xxxxxxxxx>
  • Date: Sun, 13 Dec 2009 16:56:23 -0500
  • Message-id: <4B256307.9060101@xxxxxxxxx>
Carlos E. R. wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1



On Saturday, 2009-12-12 at 19:41 -0500, Felix Miata wrote:

What broke was a motherboard. The new motherboard is compatible enough that
the kernels/drivers are able to find the disks, but the OS and/or boot loader
is/are not smart enough to accommodate what changed as a result.

Again, grub does not read labels. It uses the (hdX,Y) syntax only.

Wrong. And right.

Grub runs at two different times from two very different contexts.
http://www.gnu.org/software/grub/manual/html_node/Device-map.html

device.map is read while the OS is running and may have anything in it that the OS understands, which is a lot more than what the bios understands and what grub at boot-time understands.

For example, I have boxes booting from usb thumb drives. (I want all of the sata hot-swap drives to be used for raid, and I do not want any internal drives that can't be easily and quickly swapped out by on-site people) To the OS the thumb drive shows up after all of the hard drives on the motherboard, and before all of the other hard drives on add-in cards. To the bios, because I have set the bios settings a certain way and formatted the usb drives a certain way, the usb drive is the first drive.
Then again, after the os is all booted up, if I removed and re-inserted the thumb drive, it would become the next higher sdX letter after all the other drives. So it's not /dev/sda or /dev/sdg or /dev/sdn, yet at different times from different contexts it is each of those.

So in device.map I usually put a line that uses by-id in that case.
(hd0) /dev/disk/by-id/usb-AVIXE_USB_FLASH_DRIVE_000000000000C1-0:0

(The length of the line is utterly inconsequential. Good grief it's a computer, cut & paste was invented a long time ago, it's not like you have to write it in calligraphy with a bamboo stick on calf skin vellum from memory. And conceptualizing? Where "sda" used to refer to an address on a bus on a controller, now a long id string refers to a unique string found on the device itself, wherever and however it might be connected. What's so hard?)

I don't know how grub represents the address to the device internally but I doubt it reads device.map at boot time. Only while the os is running is there even such a thing as /dev/anything.
One thing I'm not clear on, and which almost suggests the opposite of above, as that, I know that I can use any arbitrary hd# number I want in device.map as long as I use that same number everywhere else in menu.lst and /etc/grub.conf
In other words, even if at boot-time a certain device will be the first bios drive, I don't have to call it hd0 in device.map
I can have a line that says
(hd5) /dev/disk/by-id/usb-AVIXE_USB_FLASH_DRIVE_000000000000C1-0:0
and as long as I use hd5 and hd5,<partition-number> etc in the other files, it works at boot time. That means hd0 does not mean "the drive that will be the first bios drive at boot-time", it refers to some stored internal grub table of devices, stored I know not where.

I think, from reading that documentation I referenced, that if device.map didn't exist, then the default behavior would be that hd0 refers to the first bios drive at boot time. I usually need a device.map though, because the drive that will show up as bios drive 0 at boot time is rarely the same drive that the OS, or grub while running inside the running OS, _thinks_ will be drive 0.

--
bkw

--
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse+help@xxxxxxxxxxxx

< Previous Next >