[lug] grub.conf and BIOS drive specifications

Lee Woodworth blug-mail at duboulder.com
Sun Oct 16 14:30:09 MDT 2005


D. Stimits wrote:
> I'm trying to figure out, on a machine with both IDE and SCSI 
> integrated, when booting from SCSI (the bios is set to boot scsi first), 
> or when booting from IDE (the bios is set to boot ide first), the 
> grub.conf still calls the boot device hd(0), despite the device changing 
> from scsi to ide or back. I'm trying to figure out a way that I can name 
> across both scsi and IDE, e.g., have /boot/ on scsi first drive, but be 
> able to name a root partition for one case as the ide drive, and in the 
> other case the scsi. The number of scsi disks varies, so I can only 
> predict there will be at least one scsi device, and exactly 1 ide hard 
> drive (plus ide cdrom).
 From the grub manual:
   Note that GRUB does _not_ distinguish IDE from SCSI - it simply
   counts the drive numbers from zero, regardless of their type. Normally,
   any IDE drive number is less than any SCSI drive number, although that
   is not true if you change the boot sequence by swapping IDE and SCSI
   drives in your BIOS.

The drive numbers it is talking about are the grub drive numbers and have
nothing to do with BIOS drive numbers. Remember that non-disk devices are
not counted. For (IDE0M-disk, IDE0S-CD, IDE1M-disk) the grub names are
(hd0) for IDE0M, (hd1) for IDE1M.
> 
> Since hd(0) only refers to the first drive, but does not tie it to a 
> particular controller (bios settings change which it calls the first 
> drive), in a mixed ide/scsi environment, how do I specify specifically 
> the first scsi drive? Or specifically the first ide drive? I suspect 
> there is a way to use BIOS drive number to do this, but I'm not familiar 
> with how the BIOS labels can be extracted or identified. Can I extract 
> BIOS drive numbers in a way that allows me to name the first drive of 
> scsi or the first drive of ide, and not depend on what the BIOS setting 
> is for boot scsi first or boot ide first? And in a way that won't change 
> the drive number of the IDE drive when I alter the number of scsi drives 
> plugged in to the backplane?
If the IDE/SCSI order changes, or the SCSI order changes on the BUS the grub
device names will change. Don't know of anyway to prevent that.

You can work around it by having a separate boot partition on IDE0, install
grub to that. Keep the BIOS boot order as IDE,SCSI and have the BIOS always
boot to the IDE0 boot partition. Then you have several sections in the
grub.conf on IDE0. Keep all the kernel and system map files in the boot
partition.

For example I have:
   title  Gentoo-Linux-2.6.12-r1 sda2
   root (hd0,0)
   kernel /vmlinuz-2.6.12-gentoo-r1 ro root=/dev/sda2 udev

   title  Gentoo-Linux-2.6.12-r1 sdb2
   root (hd0,0)
   kernel /vmlinuz-2.6.12-gentoo-r1 ro root=/dev/sdb2 udev

   title  Gentoo-Linux-2.6.11-r9-nfsr
   root (hd0,0)
   kernel /vmlinuz-2.6.11-gentoo-r9-nfsr ro root=/dev/nfs
     nfsroot=192.168.0.3:/mnt/sys_root ip=192.168.0.4:::255.255.255.0 udev

/dev/sdb is an external USB drive.

The root (hd0,0) stays the same (first partition on the first drive). But
you do need to change the root=... on the kernel line. Make multiple sections
giving the system root as /dev/hdax, /dev/sdax, /dev/sdbx, /dev/sdcx ...
and select the appropriate one at the grub screen for the current disk
configuration. It is helpful to have each system echo some ident info
in the local part of the startup scripts.

> 
> D. Stimits, stimits AT comcast DOT net
> _______________________________________________
> Web Page:  http://lug.boulder.co.us
> Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug
> Join us on IRC: lug.boulder.co.us port=6667 channel=#colug




More information about the LUG mailing list