Setting up a multi boot system with GRUB

14,780

Just configure one grub install to find your various kernels.

Say you have three partitions. sda1 with windows int sda2 and sda3 with a linux distro each. Your grub config sould look like this:

title Windows
rootnoverify (hd0,0)
chainloader +1

title linux 1
root (hd0,1)
kernel /path/to/kernel1

title linux 2
root (hd0,2)
kernel /path/to/kernel2

This way you can load all OSes directly via one grub. Maybe you want to install grub into the partition boot record as well. Then you could chainload the linuxes also:

title Windows
rootnoverify (hd0,0)
chainloader +1

title linux 2
rootnoverify (hd0,2)
chainloader +1

title linux 1
root (hd0,1)
kernel /path/to/kernel1

The chainload option tells grub to load the first sector of the given partition where the next bootloader is located.

Share:
14,780

Related videos on Youtube

Jacob R
Author by

Jacob R

Updated on September 17, 2022

Comments

  • Jacob R
    Jacob R over 1 year

    There are lots of OSs and Linux dists to install on your netbook, and I want to make it as easy as possible to install, remove and switch between them.

    Just installing a dist and then another one after it will replace the GRUB boot screen every time, and some dists might override previous GRUB menus entirely.

    On a previous machine I created a GRUB partition which chain-loads GRUB for each dist, but now I can't remember how I did it.

    The hard drive is currently empty, since I started playing around with repartitioning. What is the easiest way to install GRUB to a partition? Links are welcome, but please no generic "install GRUB" guides because the ones I've found haven't been relevant to my particular situation (empty hard drive, multi boot environment, no CD/floppy)..

  • matthias krull
    matthias krull over 13 years
    This seems to be Ubuntu specific. Other distributions may not encourage autodetection. grub-mkconfig is another way to create a grub2 config. Included will be the kernels in /boot only. grub-install does no autodetection for itself, it just installs grub2 according to its config and does some sanity checks.
  • invert
    invert about 13 years
    I want to accomplish the same soon, this is helpful, thanks!