Skip to main content

The pain-free guide to switching Linux distros

It's usually a good idea to stick with the same mail program when you change distro, because they don't all store mail the same way. If you intend to use the same program, you can move over your mail directory after reinstalling, which means that your mails and settings wil be preserved.

If you want to change programs and you use POP3 mail, you may have to export and import your mail. Some programs have a specific export option, but with others you should select all mail and then save them, which will save them as mbox files (virtually every mail application has an option to import mbox files).

If you use IMAP things are much simpler, as all mail is stored on the server. Copies are cached locally to speed things up, so there will be a delay when you first use your new mail program and it has to download copies of your mails again, but your mail will still be exactly where you left it.

Providing you set up a separate partition for /home, and you only need to do this once, changing distros is not a daunting task. It is easier with some forward planning, backing up configurations and package lists, but it's fairly straightforward to switch from one distribution to another without disrupting your data, and it gives you the chance to try as many distros as you like!

Dual booting

We have covered moving from one distro to another without losing your settings and data, but what if you haven't made up your mind which distro to use yet? You may want to install a new one but keep the old one available in case you change your mind. Dual booting multiple Linux distros is an easy as switching between Linux and Windows, but some care is needed in sharing your data.

First of all you have to use different home directories, say /home/jim-ubuntu and /home/jim-suse. The usernames can be the same; there is no requirement for the home directory to be /home/username; and they must have the same user IDs.

The other issue is the bootloader, as most distro installers do not add other Linux distros to their boot menu. Install OpenSUSE or your chosen distro as previously and when you get to the bootloader part of the installation, tell it to install to the root partition, not the MBR of the disk.

When you reboot, you will go straight back to Ubuntu, so you need to add a SUSE option to the Ubuntu bootloader. Open a terminal and run
sudo gedit /boot/grub/menu.lst
to load the bootloader menu into your editor, and add these lines to the bottom
title openSUSE
root (hd0,5)
chainloader +1

This adds an OpenSUSE option to the boot menu. The root command tells it where to find the SUSE installation. Grub counts from zero, so hd0,5 is the sixth partition of the first drive – /dev/sda6 in Linux terms. The chainloader command tells it to load the bootloader from that disk, which will give you the SUSE boot menu.

Now you need to make sure the user IDs are the same, so mount the SUSE partition with
mkdir -p /mnt/suse
mount /dev/sda6 /mnt/suse

Then look for your username in the /etc/passwd files on both computers
grep jim /etc/passwd /mnt/suse/etc/passwd

Each file should contain a line like
jim:x:1000:100::/home/jim-suse:/bin/bash

The first number is the user ID and the second the group ID, if they differ you need to edit /mnt/suse//etc/passwd to make them the same. Check /etc/group for the two distributions to make sure the group ID for the users group matches on both. Then run
chown -R jim: /home/jim-suse

When you're keeping the old distro you can't just move directories of data from one home directory to another: you want it available to both. The answer is to use symlinks, or symbolic links. These allow one directory (or file) to appear to be in two places. Simply do
ln -s /home/jim-ubuntu/music /home/jim-suse/music
to have the music directory appear in both home directories. With KDE, you can do this by dragging the music icon from one home directory to the other and holding down the Control and Shift keys when dropping it.

Repeat this for any data directories you wish to share, but only do it for mail if you are using the same mailer on both distros.

Now read The 14 best Linux distros