The Complete Magazine on Open Source

Distromania: A Multi-booting Template

, / 218 4

People often ask why there are so many Linux distributions. No one seems to ask why there are so many items in a buffet spread or so much variety in a botanical garden. The large number of distributions sure makes it difficult to pick the right one for a particular task; but having picked the right distribution, you have it better adapted for the task at hand.

You may not be able to sample all the items on a buffet, but you certainly can multi-boot your machine with a bunch of lively Linux distributions and zero in on your favourite set or—even better—keep all of them.

Look at it another way. You share a couple of Linux (of course!) PCs at home with family members with diverse requirements: your grandmother wants simplicity, the cousin wants multimedia, the kids want games and education tools, and you want to try out the latest distributions. Now you can meet all these requirements and pamper yourself in the bargain.

Let us get straight into looking at a partition and multi-boot scheme that you can use as-is or tailor to your requirements. I’m assuming that you understand the basics of partitioning, boot loaders, and have installed Linux distributions in the past. Even if you haven’t, I am sure you can get a leg-up from the neighbourhood know-all.


Our partition and multi-boot scheme has a two-level boot menu. It has a master boot menu listing all the installed distributions available for booting. Once you select the distro to boot from, you are taken to the dedicated GRUB menu of the specific distro you are booting.

For instance, when I select ‘openSUSE 11’ on the master boot menu, I am taken to the SUSE boot menu that lists the various options to boot openSUSE such as: a ‘normal boot’ or a ‘fail-safe session’.

We will revisit boot menus later in this article. For the moment let us get down to partitioning our disk. We are assuming a blank hard disk to keep things uncomplicated. You can start the partitioning session from a live CD such as Knoppix.

Start with a primary partition (sda1) of about 100 MB for /boot followed by a primary partition (sda2) for swap of a suitable size. Make sure the swap is larger than your RAM because this is the space used by the suspend-to-disk feature on some distros.

Of the remaining two primary partitions possible, make one an extended partition. This extended partition (sda3) will house the following logical partitions:

  • A partition (sda5) to mount as a common /tmp directory for all distributions.About 2 GB for /tmp should do for most people, but again this is a suggestion and not a recommendation.
  • Slots (sda6, sda7, and so on) for the various distributions. About 10-12 GB per distribution should be adequate for most distributions and you could even do with less.

The fourth primary partition (sda4) can be mounted as the common /home directory for all distributions. A common /home across distributions can lead to some irritations related to the desktop and we will explore a workaround later when discussing usage scenarios. If you have a capacious hard disk (and who doesn’t these days), you can have more than one partition available for mounting as /home and specify which one to mount automatically for a particular distribution during install time. If you have more than one partition for /home, make sure you create the additional ones as logical partitions inside the extended partition sda3. Choosing a common swap and /tmp partition across distributions helps you utilise your hard disk real estate that much better. You have a choice of filesystem types to use for each partition, but remember that GRUB is finicky and prefers ext3.

Depending on how much space you need for swap, /tmp and /home, you can easily arrive at how many distributions you can pack into a single hard disk. As a variation you can also pack all distributions on one hard disk and keep your data on another.

The following table shows how the partitions might look like for a single disk of 120 GB with three distributions sharing a common home partition.

sda1 (Primary) sda2 (Primary) sda3 (Extended) sda4 (Primary)
sda5 (Logical) sda6 (Logical) sda7 (Logical) sda8 (Logical)
/boot swap /tmp / (Distro 1) / (Distro 2) / (Distro 3) /home
100MB 2GB 2GB 12GB 10GB 10GB 84GB

Install procedure

One approach is to start with a bootable GRUB disk and install GRUB in the MBR of sda. This way the boot partition is not associated with any distribution. But let us take a simpler alternative and let the first distro install the boot loader for us. This way, the dedicated /boot partition gets associated with the first distribution but that does not make any material difference to the boot interface.

To keep things systematic and under control, start by installing the first distribution. Using the following table as a cue, install the first distro by providing the indicated mount points for the respective partitions.

Distro /boot /tmp Swap / /home Grub
Distro 1 sda1 (F) sda5 (F) sda2 (F) sda6 (F) sda4 (F) in MBR
Distro 2 sda5 sda2 sda7 (F) sda4 in sda7
Distro 3 sda5 sda2 sda8 (F) sda4 in sda8

For this distro you will install GRUB in the MBR and use sda1 as /boot. For all other distros, GRUB goes into the “first sector of the boot partition”. The (F) next to each partition indicates it needs to be formatted. Note carefully that from the second distro onwards, you need to format only the / partition. Remember this, lest you end up losing data that already exists in the /home or /tmp partitions.

Configuring the GRUB menu

Since we are letting the first distro take charge of the boot partition and install GRUB for us, all we have to do is edit the GRUB menu to add the other distros. The GRUB menu exists as /boot/grub/menu.lst. Here is what mine looks like today for four distros:

# grub.conf generated by anaconda
# Note that you do not have to rerun grub after making changes to this file
# NOTICE:  You have a /boot partition.  This means that
#          all kernel and initrd paths are relative to /boot/, eg.
#          root (hd0,0)
#          kernel /vmlinuz-version ro root=/dev/sda6
#          initrd /initrd-version.img


title Fedora 9 (2.6.25-14.fc9.i686)
root (hd0,0)
kernel /vmlinuz-2.6.25-14.fc9.i686 ro root=UUID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx rhgb quiet
initrd /initrd-2.6.25-14.fc9.i686.img

title OpenSUSE 11 @ /dev/sda7
rootnoverify (hd0,6)
chainloader +1

title Mandriva 2009 @ /dev/sda8
rootnoverify (hd0,7)
chainloader +1

title Linux Mint 5 (Elyssa) @ /dev/sda9
rootnoverify (hd0,8)
chainloader +1

Briefly, the initial file was generated by Fedora 9 when I installed it as the first distro. Adding the subsequent entries for other distros is easy. We just chain-load and transfer control to the GRUB of the distro we want to boot. Each of the distros, in this case openSUSE, Mandriva and Mint, automatically create their own attractive GRUB menus at install time and we can leave them untouched. Remember to get the boot partitions right for each GRUB menu entry.

Sharing the home directory

To share your files seamlessly across your Linux installations, create your users in such a way that they have the same UID on each distribution–each with their own dedicated group. For instance, you could have the uid:gid series of 500:500, 501:501, and so on. This is the simplest scheme and should work well for a typical home-computing environment. You can also create users in such a way that certain users have access to certain distros and no access to others. You can thus restrict each user to just one distribution if you wish.

Typical usage scenarios

The default scheme with the common home directory across distros works fine, except for some side effects on the desktop. Since desktop (KDE, GNOME, Xfce,…) versions vary across distros, you might get widget load errors and some unintended desktop icons while hopping from one distro to another. This is because the ‘dot’ files for your desktop are common across all distros. There is also the possibility of opening a file with a newer version of a software in one distro and rendering it unreadable by the same software with a different version number from another distro. As a solution, the following two approaches have worked for me, singly or in combination.

Rather than mount a common /home, you can let the home directory stay with the respective distro so that your desktop stays there as well. Each distro then gets its own desktop and there are no unpleasant side effects. You can then mount your previously designated home partition separately under, say, /mnt/home. If you like this approach, provision adequate space for the root (/) partition of each distro (so that a ‘small’ /home directory can stay there) and do not give any partition as a mount point for /home while installing. This way the /home directory gets created in the root partition of the distro, automatically.

The second approach is to follow some discipline. It helps to have a main distribution that you will use for mail review and other daily chores. You would rather not be messing around with mailboxes across distros. Having voted for your main distribution, you can then boot the distribution that specialises in the task at hand: perhaps media editing or gaming. With this approach, specific file and data types stay associated with a specific distribution and sanity can prevail all round.

Your mileage will vary depending on the distros you multi-boot. You should experiment to arrive at the template that works best for you and the work discipline that goes with it.

Pay day

Going by the examples in the references, you will not reach the limit on the number of distros that can be booted with a similar scheme any time soon. Once you have your PC set up with a flexible partition scheme, evaluating and comparing new distros becomes a walk in the park.

The grapevine has it that this leads to a condition called distromania. Symptoms include staring for long hours at installation progress bars and then rushing to boot a new distribution every couple of hours. Some people may need to be physically pulled away from their computers. Fortunately, in my case the condition was self-limiting—after trying out all distros that came with LFY in the past few months, I realised I had run out of CD blanks to burn more ISO images of lesser known distros. Then I quickly got down to writing this article before the next affliction could hit me. References

  • I've a 250GB hard disk Core2Duo Laptop. It is having 10.67GB Recovery partition and rest is taken by pre-installed Vista Home Premium.
    How can I apply this template on my system. What changes I need to make in grub file like sda, chainloader etc.

  • Gurudutt,

    Cool. Excellent article.

    What I do is, I have a usb drive which I use for my data and use harddisk for distros.

  • Gurudutt,

    Cool. Excellent article.

    What I do is, I have a usb drive which I use for my data and use harddisk for distros.

  • Pingback: Will Linux Multi-booting with Ubuntu 10.04 and 9.10? Drija()