On 2/24/06, Wing D Lizard <[EMAIL PROTECTED]> wrote: > How are the drives enumerated? > > I just lost my hda, but I'm running from sda ( sil3112 on > mobo). luckily, i have a grub floppy, that I can use to > boot sda. > > My bios allows me to reorder my boot devices. Does this > change my (hd2,0) to (hd0,0)?
Sort of, but not exactly. (hd0,0) will always be the 1st partition of the drive which was used to boot into grub. I've been looking into grub device naming, and now having taken a very quick and shallow look at the grub code, I've started to build a better picture of what's going on. First off, grub itself knows nothing about, and has nothing to do with linux/posix device node naming. Grub is a creature of BIOS, and thinks of the world in terms of BIOS interfaces. It reads disks using BIOS interrupt 13. During the BIOS power on self test, it builds two lists, one is the priority list of boot devices, the other is a priority list of int 13 devices. Depending on the BIOS these lists may be configurable and stored in NVRAM. POST checks the NVRAM and if it's corrupted or uninitialized it builds the lists from scratch as it scans for devices. After it's done with the POST and device scans, the BIOS executes the int 19H service routine which actually tries booting the system from devices in the boot priority list. Int 19H uses Int 13H to read the boot sector from floppy drives and hard drives (the latter really meaning IDE and/or SCSI drives). Because Int 19H only uses drive numbers '00'h (which is the first floppy drive) and '80'h (the first hard drive) the int 13H devices in the boot priority list can only be '00'h and '80'h. Only after the boot sector is loaded and given control is grub in the picture. The grub device numbering represents BIOS int 13 device numbering. (fdn) get's mapped to n and (hdn) gets mapped to n+x'80'. Because of the BIOS int 19H restrictions, the boot device will always be (hd0) or (fd0) in grub terminology. How other (HDns) and (FDns) get mapped to physical devices is up to the BIOS. It's not clear to me that this is completely specified. When you boot a machine with grub installed, you're really booting grub and not linux or any other operating system. Grub in turn loads the OS and transfers control to it. The linux device nodes /dev/sdx and /dev /hdx are assigned by the linux kernel during boot, which is well after grub has transferred control. The mapping of the letters in the device node names depends on the drive's position on the SCSI or IDE bus, and may have no relationship ot the BIOS int 13H numbering. When you run the grub COMMAND under linux it's running the grub shell but under the linux environment using linux device drivers to access the disks. The grub shell in this case attempts to guess how devnodes map to BIOS int 13H numbering, but it's just a guess. This is why it provides the /boot/grub/device.map mechanism so that the admin can TELL it the proper mapping. Again, at actual machine boot time, this mapping is neither consulted or needed since those names have no meaning at the BIOS interface. I hope that this clarifies more than it confuses. -- Rick DeNatale Visit the Project Mercury Wiki Site http://www.mercuryspacecraft.com/ -- TriLUG mailing list : http://www.trilug.org/mailman/listinfo/trilug TriLUG Organizational FAQ : http://trilug.org/faq/ TriLUG Member Services FAQ : http://members.trilug.org/services_faq/
