GRUB question

Rashkae ubuntu at tigershaunt.com
Sun May 20 22:39:10 UTC 2007


Oliveiros Cristina wrote:

> I've always believed (until now) that GRUB would look always into
> /boot/grub/menu.lst
> on the boot partition. Isn't that so ?
> 

Nope, 'fraid not.

Grub is normally installed in the hard drive MBR (master boot record),, 
the MBR is at the very start of the hard drive, before any partitions.

When the computer BIOS boots from a hard drive, it always executes the 
contents of the MBR.  In a traditional Microsoft install, the MBR 
contains code that then bootstraps the code at the start of the boot 
partition.  If that code isnt' there, then a "Boot" partition has 
absolutely no meaning.  You can think of this as the most basic of 
bootloaders ever designed.

If you install grub in the MBR (default), however, grub is installed 
with a permanently designated boot partition.  For example, if you were 
installing grub from the grub shell, you might do so like this.

setup (hd0) (hd0,0)

The (hd0) is where grub will be installed, in this case, since there is 
no partition number, it will be the MBR itself.  (hd0,0) is the boot 
partition to use.

If you wanted different grubs to read different menu.lst files, you 
could instead install grub on the partition rather than the Hard Drive 
MBR.  From the grub shell:

setup (hd0,0) (hd0,0)
setup (hd0,1) (hd0,1)

*Warning: this is safe on ext3 filesystems, but don't do it to XFS.  XFS 
uses the superblock for it's own nefarious purposes, and does not allow 
for a boot area.

That way, each of two partitions now has it's very own grub.  However, 
before this works, you need to install something in the MBR that will 
bootstrap the boot partition... If you have an old dos / Windows 9x boot 
disk, fdisk /mbr should do the trick... from linux, you can do this with 
lilo  -M /dev/hda





More information about the ubuntu-users mailing list