Results 1 to 10 of 48

Thread: How to Multi-boot (Maintain more then 2 OS)

Threaded View

  1. #1
    Join Date
    Apr 2006
    Kubuntu Development Release

    Thumbs down How to Multi-boot (Maintain more then 2 OS)

    How to Multi-boot (Maintain more then 2 OS)

    Be aware this thread is from 2008 and is out of date as it uses grub 1. I have left it for historical reasons, but it is no longer maintained. Links may be broken. Please see any of the grub 2 guides, either on the Ubuntu wiki or forums.

    Ubuntu wiki grub2
    Ubuntu forums grub 2
    Grub 2 Tweaks

    Dual booting is fairly straight forward, but what happens when you would like to boot multiple (more then 2) operating systems ?

    If you are new to Ubutnu, or wanting "simply" to install Ubuntu and Dual boot with Windows, this is not the best tutorial, although you may find it informative. Please refer to this wiki page:

    In this how-to I will cover primarily booting multiple Operating Systems, primarily Linux Distributions (Versions), using GRUB. For other OS, see the following links :

    1. Booting multiple versions of windows can be tricky as you need to "hide" the various windows installs from each other.2. BSD can bee more cryptic :3. NetBSD and OpenBSD :
    Note to Vista users
    : Please refer to this link (EasyBCD)

    1. Prerequisites ~ "things you should already know".
    2. General overview of the boot process.
    3. Partitioning.
    4. Sharing partitions.
    5. Install a new OS, manually configure GRUB.
    6. Automate maintenance of GRUB with Chain loading.
    7. Automate maintenance of GRUB with "configfile".

    To automate maintenance, either chainload or configfile (not both).

    Prerequisites ~ "things you should already know" :

    You must have a solid understanding of partitioning and partitioning naming (both Linux and GRUB numbering schemes). While Windows letters partitions ( C:\) , Linux uses /dev/sdxy (or /dev/hdxy) and Grub numbers partitions starting with 0.

    If you need a refresher on partitioning terminology see this link :

    Partitioning basics

    For this tutorial, think of each installation as needing both a root ( / ) partition and a boot directory (or separate /boot partition if using XFS, LVM, or encryption).

    You will also find it helpful to have some understanding of grub configuration. Hermanzone is was great resource for grub (The grub 1 information is no longer maintained).If you understand partitioning and basic GRUB configuration, Mult-booting is not too hard.

    Hermanzone grub 2 page is located here

    General overview of the boot process :

    The details of the boot precess are beyond this tutorial, but here is a nice summary from Wikipedia :

    When a computer is turned on, the computer's BIOS finds the primary bootable device (usually the computer's hard disk) and transfers control to the master boot record (MBR), the first 512 bytes of the hard disk.

    The MBR contains GRUB stage 1. Given the small size of the MBR, Stage 1 does little more than load the next stage of GRUB (which may reside physically elsewhere on the disk). Stage 1 can either load Stage 2 directly, or it can load stage 1.5: GRUB Stage 1.5 is located in the first 30 kilobytes of hard disk immediately following the MBR. Stage 1.5 loads Stage 2.

    When GRUB Stage 2 receives control, it presents an interface to the user in order to select which operating system to boot. This normally takes the form of a graphical menu, although if this is not available or the user wishes further control, GRUB has its own command prompt, where the user can manually specify the boot parameters. GRUB can also be set to automatically load a particular kernel after a timeout period.

    Once boot options have been selected, GRUB loads the selected kernel into memory and passes control on to the kernel. At this stage GRUB can pass control of the boot process to another loader using chain loading if required by the operating system.


    The boot directory is normally on the root ( / ) partition and contains, amongst other things, your kernel(s), initrd (initial ram disk), and grub (particularly menu.lst).

    A separate /boot partition is required with GRUB if you use XFS, LVM, and/or encryption for your root partition.

    You can not share a /boot partition (the problem is that most distributions will overwrite your /boot partition when you install them).

    Partitioning :

    In general I allocate 512 Mb for a boot partition (if needed), 5-10 Gb for the root partition ( / ), and a separate /data partition for user data (40 - 100 Gb).

    Sharing partitions :

    You can not share a /boot partition with multiple distros.


    Your swap partition can be shared between Linux distors and even BSD (you need only one swap). The problem may be that some distros will automatically format your swap space (during the installation), and if it is formatted, the UUID will change. In this event you will need to edit /etc/fstab (on any old OS) and update the uuid or mount swap using /dev/sdxy . If you use /dev/sdxy you not need to update fstab if swap is formatted again during a future install. How to fstab.

    Conflicts with a shared /home

    While the idea of sharing a /home partition may sound good, use caution in doing so. The potential problems include :

    1. A "rude" OS (or the wrong click of a mouse) may format or overwrite /home without asking permission first. Although rare these days, such rude behavior (or mistakes) will result in data loss.
    2. Your user is identified to the system by an id number (uid) and not a name. Ubuntu starts numbering users with 1000, but this is not standard. Fedora, for example, starts numbering users with 500. So even if your user name is the same on both Fedora and Ubuntu, you will have different uid. Because the uid are different you will no longer "own home".
    3. The other potential conflict is with your configuration or dot ( . ) files in /home. While you may be able to share these files in different versions of Ubuntu, you may have conflicts with other distros or varying versions of applications (gnome, gimp, etc.).

    This problem can be "solved" by using different user names with each distro, or better a /data partition.

    Shared /data partition.

    I advise you make a shared data partition for data you wish to share across distros and leave /home (and the configuration files) on your root partition. You will likely still have permission problems, but this will eliminate conflicts with configuration files in a shared /home partition.

    You can minimize permission problems while maintaining security by making a new group, say "data", and giving ownership of the data partition to with permissions of 770.

    As with a shared home, be careful not to format or overwrite your /data partition. (or add your data partition to /etc/fstab post-install).

    Install a new OS, manually configure GRUB :

    Normally, when you install a new OS, you will re-install GRUB to the MBR and GRUB will now point to your new OS when loading Stage 1.5. Many times your new OS will find and automatically add your old OS to the grub menu. If not, you will need to manually edit /boot/grub/menu.lst and add in your old OS.

    The "problem" with manually editing menu.list is that you will need to manually update the kernel line of the (GRUB) boot stanzas when you upgrade a kernel on the old OS.

    A typical grub stanza looks like this:

    title Ubuntu hardy (development branch), kernel 2.6.24-11-generic
    root (hd0,1)
    kernel /boot/vmlinuz-2.6.24-11-generic root=UUID=b485ef35-1e30-4709-91
    initrd /boot/initrd.img-2.6.24-11-generic
    The highlighted kernel and initrd need to be manually updated with each kernel update (Old OS only).

    If you prefer to manually edit /boot/grub/menu.lst with each kernel update, you are done.

    You can automate the process if you make use of chainloading (see next section).

    Automate maintenance of GRUB with Chain loading :

    This section is optional, but makes maintenance much easier.

    To automate maintenance, either chainload or configfile (not both).

    You probably think of chainloader as a method of booting Windows or BSD, but you can boot Linux via chainloading.

    As the name implies, GRUB passes the control of the boot sequence to another bootloader, located on the device to which the menu entry points. This can be a Windows operating system, but also any other, including Linux.
    The advantage of chainloading includes :

    1. The stanzas in menu.lst are greatly simplified
    2. Each OS will automagically update menu.lst (in their respective /boot directories/partitions) and you will not need to manually update the boot stanzas when you upgrade a kernel.

    The "trick" is you need to install GRUB into your (target) root partition.

    By far, the easiest way to do this is to install grub BOTH to the MBR and your root (or /boot) partition with each install.

    You can manually install grub (as root) like this :

    sudo grub
           [ Minimal BASH-like line editing is supported.   For
             the   first   word,  TAB  lists  possible  command
             completions.  Anywhere else TAB lists the possible
             completions of a device/filename. ]
    grub> root (hd0,1)
    grub> setup (hd0,1)
    grub> quit
    Note: You will need to change (hd0,1) to your root partition (or boot partition if you use XFS, LVM, or encryption). ("setup (hd0)" at the grub prompt installs grub to the MBR).

    This greatly simplifies your boot stanzas. For each old OS edit the boot stanza to look like this :
    title Fedora 8
    root (hd0,0)
    chainloader +1
    Note: Again change (hd0,0) to the appropriate (Fedora) root partition (or boot partition if you used the Fedora defaults and set up a LVM).

    Configure GRUB (on your old, chainloaded OS)

    Now when you boot, if you select your new OS, if you select the new OS on the grub screen it will boot directly into the new OS.

    If you select an old OS, however, you will get a second grub screen. Select the old OS a second time.

    If it is working, you can set the grub defaults for the old OS. First boot the old OS and edit the /boot/grub/menu.lst.

    You will want to make sure the "default" is 0 and set the "time out" to 0.

    ## default num
    # Set the default entry to the entry number NUM. Numbering starts from 0, and
    # the entry number 0 is the default if the command is not used.
    # You can specify 'saved' instead of a number. In this case, the default entry
    # is the entry saved with the command 'savedefault'.
    # WARNING: If you are using dmraid do not use 'savedefault' or your
    # array will desync and will not let you boot your system.
    default 0

    ## timeout sec
    # Set a timeout, in SEC seconds, before automatically booting the default entry
    # (normally the first entry defined).
    timeout 1
    After these changes, when you boot the old OS you will see the second GRUB screen for 1 second (this allows you to select recovery mode if needed).

    When you upgrade the old OS to a new kernel the second (chain loaded) GRUB will automatically be updated and no manual edit is needed.



    Imagine dual booting Fedora and Ubuntu with the following partitions:
    /dev/sda1 = boot partition (for Fedora)

    /dev/sda2 = LVM = Fedora root ( /)

    /dev/sda3 = Ubuntu root (this partition contains the boot directory for Ubuntu).

    /dev/sda4 = swap

    1. Lets start by installing Fedora first, using LVM and thus /dev/sda1 as the Fedora /boot.
    2. Next, from the Fedora live CD, install GRUB into /dev/sda1 (Fedora /boot)

      root@fedora# grub

      grub > root (hd0,0)
      grub > setup (hd0,0)
      grub > quit
    3. Now boot and install Ubuntu to /dev/sda3
    4. Again, from the Ubuntu live CD, install grub to /dev/sda3
      Note: This step is not needed at this time, but sets up the Ubuntu OS to be chainloaded if a third OS is installed later.
    5. Post install boot Ubuntu. Edit /boot/grub/menu.lst to chainload Fedora
      title Fedora 8
      root (hd0,0) <-- Note Fedora /boot partition
      chainloader +1
    6. Boot Fedora and modify /boot/grub/menu.lst, change the time out to 1


    Automate maintenance of GRUB with configfile :

    This section is optional and also makes maintenance much easier.

    To automate maintenance, either chainload or configfile (not both).

    I recently learned of this option and IMO it is by far the easiest method. It is similar to chainloading (which is why I left chainloading first), but takes a single line in /boot/grub/menu.lst.

    A sample entry looks like :

    title        Ubuntu 8.04
    configfile   (hd0,0)/boot/grub/menu.lst
    title        Fedora 9
    configfile   (hd0,1)/boot/grub/menu.lst
    Caveats :
    • grub must be installed in the target partition (hd0,1) and (hd0,1) in the above example.
    • /boot/grub/menu.lst must exist in the target partition.
    • /boot/grub/menu.lst in the target partition must boot the kernel, ie the boot stanza must list vmlinuz and initrd, like this :
      title Ubuntu hardy 8.04
      kernel /boot/vmlinuz-2.6.24-11-generic root=UUID=b485ef35-1e30-4709-91
      initrd /boot/initrd.img-2.6.24-11-generic

    Reference :


    Next install as many OS as you like, always installing grub into the root ( / ) partition (or /boot partition) of each OS.

    Hope this helps making multi-booting a little easier.

    Peace be with you,

    Last edited by bodhi.zazen; October 23rd, 2010 at 03:04 PM. Reason: Added information re: configfile
    There are two mistakes one can make along the road to truth...not going all the way, and not starting.
    --Prince Gautama Siddharta

    #ubuntuforums web interface


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts