Chainload with Grub to boot multiple systems

Share your own howto's etc. Not for support questions!

Chainload with Grub to boot multiple systems

Postby dawgie » 2006-02-04 00:37

Using chainload with Grub to boot multiple systems

In an effort to stay organized, and have easy access to various operating systems and kernels on a testing system, I make use of Grub chainloader command. I install Grub in the root partition of each OS.


Warning: if you don't understand what you are doing, you could make your system unbootable!




Each time I install an OS, I install Grub to it's root partition.

example
In my example, I have a different OS on hda5, hda9, hda11, hdc1, hdc3


If I install an OS in hda11, I run the command
# grub-install /dev/hda11
Then I edit the /boot/grub/menu.lst file
I replace the entries section below the "automagic kernels list" with my chainloading entries.
I repeat this with each OS.


Example section of my menu.lst for /dev/hda5:
note the chainloader section after the "AUTOMAGIC KERNELS LIST"

Code: Select all
## ## End Default Options ##

title           Debian Sid kernel 2.6.15-1-k7
root            (hd0,4)
kernel          /boot/vmlinuz-2.6.15-1-k7  root=/dev/hda5 ro
initrd          /boot/initrd.img-2.6.15-1-k7
savedefault
boot

title           Debian Sid kernel 2.6.15-1-k7 (single user mode)
root            (hd0,4)
kernel          /boot/vmlinuz-2.6.15-1-k7  root=/dev/hda5 ro single
initrd          /boot/initrd.img-2.6.15-1-k7
savedefault
boot

title           Debian Sid kernel kernel 2.6.13.4
root            (hd0,5)
kernel          /boot/vmlinuz-2.6.13.4-k7 root=/dev/hda5 ro
savedefault
boot



### END DEBIAN AUTOMAGIC KERNELS LIST

# Chainloader List

title Sid on hda5
rootnoverify (hd0,4)
chainloader +1


title Ututo on hda9
rootnoverify (hd0,8)
chainloader +1


title Debian Etch on hda11
rootnoverify (hd0,10)
chainloader +1


title Blag on hdc1
rootnoverify (hd2,0)
chainloader +1


title Debian Sarge on hdc3
rootnoverify (hd2,2)
chainloader +1


Make a Grub floppy

Note that the command
# grub-floppy /dev/fd0
Will install the Grub system on a floppy.
This is what you want if you want to just use the Grub prompt on a bootable floppy. This is OK for a tool to rescue someone else's machine, but most of the time you want to use the next option.

To create a Grub floppy that is specific for your system and has a boot menu:

# grub-install /dev/fd0
Then edit the menu.lst on the floppy. Remove any reference to splash screen (if your splash screen image is not found, it could make the boot floppy usless).
I use a simplified file with just my chainloading entries for each partition.
This is what mine looks like:


Code: Select all
# menu.lst - See: grub(8), info grub, update-grub(8)
#            grub-install(8), grub-floppy(8),
#            grub-md5-crypt, /usr/share/doc/grub
#            and /usr/share/doc/grub-doc/.

# Simplified menu.lst example

## default num
default         0

## timeout sec
timeout         10

## ## End Default Options ##
# Chainloader List

title Sid on hda5
rootnoverify (hd0,4)
chainloader +1


title Ututo on hda9
rootnoverify (hd0,8)
chainloader +1


title Debian Etch on hda11
rootnoverify (hd0,10)
chainloader +1


title Blag on hdc1
rootnoverify (hd2,0)
chainloader +1


title Debian Sarge on hdc3
rootnoverify (hd2,2)
chainloader +1




Resources

Creating a bootable Grub CD
Grub Manual
http://www.gnu.org/software/grub/manual/html_node/

Thanks to Leon G. for the idea!

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This is a re-post that I did in another forum. I don't seem to be able to access anymore.
Edited: to repair grub CD link
User avatar
dawgie
 
Posts: 431
Joined: 2004-06-16 21:30
Location: New Hampshire USA

Return to Docs, Howtos, Tips & Tricks

Who is online

Users browsing this forum: No registered users and 3 guests

fashionable