This wiki was updated to MediaWiki 1.37. If you notice any issues, please report them to admin[at]

SDB:Install another distribution

Jump to: navigation, search
Multiple Linux installations can be installed onto the same computer, and even onto the same hard disk. This HOWTO will help you to ensure that they boot correctly, share data when desired, and don't overwrite one another's settings.

Linux multiboot pitfalls

A Linux installation requires a bootloader to boot, and if several installations are required on the same computer - especially on the same hard disk - care must be taken to ensure that they each have their own bootloader, or that the bootloader they share is correctly configured for all of them.

Typically, it is also desirable to be able to share data between installations, and although this can be achieved by sharing a single 'home' partition, this can cause serious and hard to detect problems when one installation's configuration files (such as dotfiles [1]) are overwritten by another. It is preferable to use a neutral 'data' partition, and then automatically mount it at boot, with the desired read and write permissions for user accounts. Optionally, users' data directories such as 'Documents' and 'Music', or specific files such as a browser's bookmarks, can be placed on the shared data partition, and then symbolic links (symlinks [2]) can be used to access them transparently and safely. This HOWTO will explain all of these steps.

Layout and strategy

Before installing anything, decide how you intend to divide your disks between installations, and control which system boots. Although many strategies for controlling the boot exist, two will be described in detail here - which you pick will depend in part on your hardware setup.

Strategy one: BIOS popup menu

When: If you have enough space to place each Linux installation's root partition on a separate disk, and your BIOS supports a popup boot menu

If you can place each Linux (or similar Unix-like operating system) installation on a separate disk, the easiest way to determine which system boots is to use a BIOS popup menu - usually accessed by pressing a key such as Esc during the boot. If your system has such a menu, this is a perfectly viable and simple solution. Consult your motherboard or computer manual to check.

  • Allocate a separate disk for each Linux root partition.
  • Other Linux partitions (such as home, data or swap partitions) and Windows installations do not need a separate disk.

Strategy two: Using a primary bootloader

When: If you intend to place more than one Linux installation's root partition on any single disk, or if your BIOS does not support a popup boot menu

If you need to place more than one Linux (or similar Unix-like operating system) installation on any given disk, an effective strategy is to use one bootloader to chain load [3] the others.

  • Designate one Linux installation which you will use to control the boot. We will call this your primary Linux, and the disk it is on your primary disk.
  • Partitions can be placed anywhere the system allows.

Alternative strategies

If you have many Linux installations, you may consider using a GRUB partition. See [4]

Partitioning and installation

First, space must be created for the additional Linux installations, and optionally a data partition. You can create the partitions before installation, using a specialist tool such as GParted Live [5], or a standard Linux live system such as an openSUSE LiveCD, or you can create them within the installation routines as you install.


Warning: Editing partitions can cause permanent data loss, and should only be attempted once all important data on the entire physical disk is backed up to another physical disk

If you need to shrink a Windows partition, it is very important that you defragment it several times first to avoid data loss. Then resize the partition using the Windows partition tools - consult your Windows documentation. Linux partitions do not normally require defragmentation.

General considerations

  • There are system dependent limits on partition sizes, and how far into the disk a bootable partition can be placed. This should not present a problem on modern systems, but if an installation refuses to boot, it is possible that moving it closer to the start of the disk will help.
Suggestion: Allocate a 15 - 25 gigabyte root partition for each installation. Less is possible if you are short of space, but you won't be able to install as much software
  • Many people share a swap partition between different Linux installations to save space, but this can cause problems if you hibernate one system, then boot another. If you have problems with resuming from hibernation, consider trying separate swap partitions.
Suggestion: Allocate a single swap partition, no larger than the size of your RAM. Smaller is fine if you have lots of RAM, but you may not be able to hibernate your systems
  • It is normally recommended that you create a separate home partition when installing Linux, rather than leaving your users' home directories on the root partition. This isolates the users' data from the system files, and allows easier backing up and reinstalling, or upgrading between versions. If you are installing lots of different Linux systems in parallel, you will end up with lots of partitions, which can create confusion, but on modern systems will not normally cause problems in itself. Alternatively, bear in mind that if you are using a data partition, your users' data files will not take up space on the partition with the home directories on. Leaving the home directories on the root partitions is therefore less problematic.
  • If you wish to use a data partition you should ensure that you format it to a file system that all of your Linux installations can read. If you are unsure, ext3 and increasingly ext4 are safe options.
Suggestion: If you are not using a data partition, divide the rest of your available space between home partitions for each Linux installation. If you are using a data partition, give most space to that, and format it to ext4: you will not need to create home partitions, but if you do, make them small - anything above 5 gigabytes is probably unnecessary


Warning: Replacing the Master Boot Record (MBR [6]) of an operating system can prevent access to encrypted, or preinstalled diagnostic or recovery partitions. It may also make the installation of Windows' Service Packs more complicated. Although the following instructions should not require you to replace the MBR, some other Linux distributions will do so without permission. Consult the documentation for the distribution you are installing, and if unsure, experiment on a non-critical drive

Install each system (for tips on moving bootloaders on systems you have installed already, see next section).

  • For any Linux installed to a disk with another operating system (such as Windows) on already, install the bootloader to the root partition. The MBR may well contain boot code which will allow other systems on the disk to boot, and it should not be altered unnecessarily. See following section for tips.
  • For each disk with no other operating system on already, install one Linux bootloader to the MBR (this must include the primary Linux's bootloader, if it is on such a disk). Install any other bootloaders to their root partitions.
  • Be aware that some Linux installation routines may install to the MBR of the first disk without permission. See Repairing a Windows boot sector if required.

Create user accounts in the same order for each Linux installation to simplify data sharing - see Sharing access to data below for details.

Fixing the boot

Now ensure that each system can boot, and that the correct system boots by default.

Strategy one: BIOS popup menu

Use the BIOS popup menu to attempt to boot each Linux system. For any that do not boot;

Strategy two: Using a primary bootloader

Boot the system. If your primary Linux does not boot;

  • You may need to set your primary disk to boot first in the BIOS. Consult your motherboard or computer manual.

The primary Linux system should now boot. Depending on which bootloader your primary Linux uses, use the following instructions to prepare it to boot the other Linux installations.


As root, edit the file /etc/lilo.conf

Add the following lines for each installation;


Substituting the disk number for X, the partition number for Y, and an appropriate name for <name>. To chain load a bootloader on the MBR of a disk, just use hdX. Save the file, then run;

# lilo

To update LILO.


GRUB (sometimes called GRUB 1 or GRUB legacy) is any version of GRUB before 1.9. As root, edit the file /boot/grub/menu.lst

In the section containing the menu entries, add the following lines for each installation;

title <name>
    chainloader +1

Substituting the disk number for X, the partition number for Y, and an appropriate name for <name>. Remember that GRUB counts from zero, so disk one, partition one would be called (hd0,0). To chain load a bootloader on the MBR of a disk, just use (hdX). Save the file.

If you have problems finding a partition, try running the following commands as root;

# grub
# find /etc/lilo.conf
# find /boot/grub/menu.lst
# find /boot/grub/grub.cfg
# quit

GRUB should return a list of bootable partitions, with LILO, GRUB and GRUB 2 on respectively.


GRUB 2 (versions 1.9 and onwards) is designed to automatically detect other operating systems. Run the following command, as root;

# update-grub

Hopefully, upon reboot, your system will have detected your other installations. If any have not been correctly detected, edit the file /etc/grub.d/40_custom as root. Add the following lines for each installation you wish to chain load;

menuentry "<name>" {
    set root=(hdX,Y)
    chainloader +1    

Substituting the disk number for X, the partition number for Y, and an appropriate name for <name>. Remember that GRUB 2 counts disks from zero and partitions from one, so disk one, partition one would be called (hd0,1). To chain load a bootloader on the MBR of a disk, just use (hdX). Save the file.

Optionally, if you are chain loading all your other operating systems, you can disable the script which attempts to automatically detect them, to reduce menu clutter. As root;

# chmod -x /etc/grub.d/30_os-prober

Before rebooting, you will need to update GRUB 2. As root;

# update-grub

Sharing access to data

This section contains optional suggestions.

User identifiers

Linux determines filesystem permissions with a User Identifier (UID [7]). Normally, each user's UID should be unique, and above 999. If you have set up the users in the same order on each system, they may not need adjusting. Check by booting each system, and for each user, running;

# su <username>
$ id

Substituting the username, and entering their password when requested. For any which are incorrect, change them as root with;

# usermod -u <UID> <username>

Substituting the desired UID and the username. Files belonging to the user but outside the user's home directory may need to have their ownership changed to the new UID, although this shouldn't be a problem with a new install.

Mounting a data partition automatically

To automatically mount a data partition at boot, boot into each installation. Make a mountpoint, by running, as root;

# mkdir /mnt/data

Edit the file /etc/fstab, also as root. Add the following line;

/dev/sdXY            /mnt/data    <filesystem>       defaults      0  2

Substituting the data partition's disk number for X, its partition number for Y, and the filesystem you have formatted it to. Depending on your distribution's security model, you may need to alter the permissions with 'umask'. Check your local 'man fstab', or your distribution's instructions.

Sharing user data directories

You can also place the users' data directories, such as 'Music' and 'Documents', on the data partition, so they will be shared between different installations.

Warning: You will need to delete the users' data directories. Move their contents to a safe place first!

Ensure that your data partition is mounted. As root;

# mount -a

Create a directory on the data partition for each account you wish to use shared directories for;

# mkdir /mnt/data/<username>

Create each shared directory;

# mkdir /mnt/data/<username>/

Ensure that the original data directory is empty;

# ls -a /home/<username>/

If anything (apart from '.' and '..') is present, move it somewhere safe. Remove the directory;

# rmdir /home/<username>/

Create a symbolic link to its new location;

# ln -s /mnt/data/<username>/ /home/<username>/

Boot into each Linux system which will use the shared directory. Repeat the steps from 'Ensure that the original data directory is empty'. Finally, ensure that the directories have correct ownership;

# chown <username> /mnt/data/<username> -R

Sharing other files

Other files, such as a browser's bookmarks, can be shared in the same manner. When it is safe to do this is a judgement call; always maintain good backups, as accessing a file from two different versions of the same software can potentially cause program or system instability and data loss.

See also

External links

  • If you get stuck, search the forums, and if still stuck, start a thread: [8]
  • For GRUB partitions: [9]