The pain-free guide to switching Linux distros
How to effortlessly swap between distros without losing files
It's considered good practice not to fill a partition beyond 80%, as filling that last 20% can lead to fragmentation. But remember that you're going to remove the contents of /home after resizing, so you can probably pull that slider as far over as you want.
You can delete the swap partition for now, too – the installer will create a new one for you, after right-clicking it and selecting Swapoff from the menu.
Now, create a partition in the vacated space. There's a limit of four primary partitions, so use logical partitions whenever you can. Press Apply to start the process – this is the risky part and it's best to leave the computer undisturbed.
Once you've created the new partition, it's safest to reboot to the Live disc again, to make sure the kernel knows about the new partition layout.
Now, you need to move the files from the old /home directory to the new partition. This must be done as the root user, so open a terminal and type sudo -i to become root. If the root partition is on /dev/sda1 and the new partition on /dev/sda6, the commands to make the copy are:
mkdir -p /mnt/{root,home}
mount /dev/sda1 /mnt/root
mount /dev/sda6 /mnt/home
rsync -a /mnt/root/home/ /mnt/home/
rm -fr /mnt/root/home/*
This assumes you have a relatively small amount of data in the home directory, otherwise you won't be able to shrink the root partition as much as you need and will have a lot of wasted space after moving the file.
If you can't move some of this off the main disc, say to DVDs or an external drive, an alternative is to create your new home partition at the end of the space made available by shrinking the root partition, making it just large enough to hold your files.
Get daily insight, inspiration and deals in your inbox
Sign up for breaking news, reviews, opinion, top tech deals, and more.
After moving the files, you can shrink the root partition further, create a third partition in the vacant space and move your home directory to that. Now, delete the partition at the end of the disk and resize the home partition to use its space.
Keep your config
A separate home partition keeps your user settings safe, but what about those system configurations you've got just right? If you've tweaked your xorg.conf or Samba setup, you don't want it to disappear forever. System settings are stored in /etc, so the easiest option is to back up this directory to your /home partition.
sudo tar czf /home/ubuntu-etc.tar.gz/etc
will archive all of /etc into a single file in /home. Sudo is necessary because some of /etc can't be read by a normal user: /etc contains sensitive information that only the superuser should be allowed to read. You could copy the directory with
cp -a /etc /home/ubuntu-etc
but an archive is probably more convenient. You might be tempted to copy only files you need, but you may regret that later when you find you missed one. An archive of /etc doesn't take up much space – usually a couple of megabytes.
Which programs are you using?
Apart from customising the system and user configurations, the other main change made to a system is installing extra packages.
Keeping track of what you've installed is quite easy, but transferring this to the other computer isn't as simple because of the differences in the way distros package various programs. Some produce a single package for a program, while others split it into program, library and development packages.
Another obstacle is that the package list contains all installed packages, some of which are only needed as dependencies – possibly distro-dependent dependencies – of other packages that you may or may not want to install. The best advice is to read through the list of packages, exclude the obvious dependencies, such as anything starting with lib or ending in -dev or -devel, and pick out the programs you know you want to run. Let the new distro's package manager handle installing the correct libraries and other dependencies. Generating the list of packages depends more on the underlying package manager, so for any Debian derivative, use:
dpkg --list >packages.txt