install grub on LVM

Rick Stevens rstevens at internap.com
Tue Sep 18 22:15:15 UTC 2007


On Tue, 2007-09-18 at 16:23 -0500, Bob McClure Jr wrote:
> On Tue, Sep 18, 2007 at 04:10:37PM -0500, Fred Grant wrote:
> > On Tue, 2007-09-18 at 10:02 -0500, Bob McClure Jr wrote:
> > > On Tue, Sep 18, 2007 at 06:39:20AM -0500, Fred Grant wrote:
> > > > I want to install grub on hd1 boot partition which is LVM.
> > OK it's not LVM, it's ext3.  I must have been looking at swap.
> > > 
> > > hd1?  Do you mean hda?  Or hda1?
> > > hda1
> > > I didn't think you could boot LVM partitions.  Let's be clear on this.
> > > An LVM partition is somewhat like an extended partition in that it
> > > does not contain any kind of filesystem.  It does, however, contain
> > > one or more logical volumes each of which which may contain a
> > > filesystem.
> > > 
> > > Customarily, there is (at least) one plain linux partition with an
> > > ext[23] filesystem on it, which is designated as the /boot partition.
> > > You will likely have another partition, type LVM, which contains one
> > > or more logical volumes containing filesystems for /, /home, etc.
> > > Still, you would normally install grub on the MBR of that disk, e.g.,
> > > for /dev/hda
> > > 
> > >   grub-install /dev/hda
> > I did this and result is indicated below.
> 
> While booted to FC5?  If so, show us the grub.conf for that system.
> 
> > > Care to share a bit more information about your desired setup?
> > ------------
> > fdisk:
> > Disk /dev/hda: 30.7 GB, 30750031872 bytes
> > 255 heads, 63 sectors/track, 3738 cylinders
> > Units = cylinders of 16065 * 512 = 8225280 bytes
> > 
> >    Device Boot      Start         End      Blocks   Id  System
> > /dev/hda1   *           1          13      104391   83  Linux
> > /dev/hda2              14        3738    29921062+  8e  Linux LVM
> > 
> > Disk /dev/hdb: 61.4 GB, 61492838400 bytes
> > 255 heads, 63 sectors/track, 7476 cylinders
> > Units = cylinders of 16065 * 512 = 8225280 bytes
> > 
> >    Device Boot      Start         End      Blocks   Id  System
> > /dev/hdb1   *           1        7288    58540828+  83  Linux
> > /dev/hdb2            7289        7476     1510110    5  Extended
> > /dev/hdb5            7289        7476     1510078+  82  Linux swap /
> > Solaris
> > 
> > Disk /dev/dm-0: 29.5 GB, 29527900160 bytes
> > 255 heads, 63 sectors/track, 3589 cylinders
> > Units = cylinders of 16065 * 512 = 8225280 bytes
> > 
> > Disk /dev/dm-0 doesn't contain a valid partition table
> > 
> > Disk /dev/dm-1: 1073 MB, 1073741824 bytes
> > 255 heads, 63 sectors/track, 130 cylinders
> > Units = cylinders of 16065 * 512 = 8225280 bytes
> > 
> > Disk /dev/dm-1 doesn't contain a valid partition table
> 
> The above two errors can be ignored.
> 
> > -------------------
> > Per the above, I have F5 installed on hda and Ubuntu live cd on hdb.  In
> > BIOS I select "boot from HDD1" and boot fails.  If I select "boot from
> > HDD2", boot succeeds.  Is it possible that BIOS considers hda to be
> > HDD2?
> 
> Could be.  The BIOS will tell you.
> 
> > Can it be toggled?
> 
> In most recent machines, yes.  Look in the BIOS under something like
> Boot Order or drive swapping.  Rick has a lot more experience with
> that and can probably tell you exactly.

Hoo boy!  It depends on the BIOS.  First, keep in mind that grub doesn't
know about hda, hdb, etc. as those are what the Linux kernel calls them.
In fact, there is no "hd" stuff in the F7 and later kernels.  All hard
drives are treated as SCSI drives and are given the names "sda", "sdb",
etc. regardless of their interface type (for example, ATA is really just
SCSI over IDE cables).

Now this depends on the specific BIOS involved, but the vast majority
give the first bootable hard drive the low-level identifier of 0x80, the
second drive 0x81 and so on (this traces back to the old BDOS "int15"
calls to the BIOS) and THOSE are what grub relies on (in fact, the old
LILO boot loader used the "0x80"-type nomenclature).  While they're
called "hd(drive,partition)" in grub's config file, that's just to
differentiate hard drives from floppy drives.  You can think of grub's
"hd(0,..." as meaning "BDOS device 0x80", and "fd(0,..." means "BDOS
device 0x00".

So by changing the boot order in your BIOS, you've forced it to assign
your SECOND drive the 0x80 identifier and the FIRST drive the 0x81
identifier.  Since Linux inherits the primary drive from the boot loader
(and BIOS), it will think your SECOND drive is hda (or sda), and the
FIRST drive as hdb (or sdb).

I'm guessing that's probably more than you want to know, but there it
is.  ;-)

----------------------------------------------------------------------
- Rick Stevens, Principal Engineer             rstevens at internap.com -
- CDN Systems, Internap, Inc.                http://www.internap.com -
-                                                                    -
-               The Theory of Rapitivity: E=MC Hammer                -
-                                  -- Glenn Marcus (via TopFive.com) -
----------------------------------------------------------------------




More information about the Redhat-install-list mailing list