If you change the Linux distribution, everything on your computer will be deleted by default. The same applies if you reinstall an upgrade to avoid possible complications.
It turns out that it is actually fairly easy to do new installations or change Linux distributions without losing data. Here you will learn how to proceed so that you can make all settings regardless of your current situation.
How does it work?
What is the magic with which you can store all your personal data? Simple: separate partitions.
If you change the Linux distribution, you must tell the installer what partition configuration you want on your hard drive. If Linux is the only operating system on the hard drive, you most likely have one or two partitions. This includes the main partition, which is usually formatted as ext4 and contains the operating system and all of your data.
Optionally, you can also set up an additional partition called a swap partition
What is a Linux swap partition? Everything you need to know
. This is part of your hard drive that is used as RAM overflow, as well as the location where RAM data is stored during hibernation.
However, you are free to create as many partitions as you want, and you can tell the installer which partitions to use for which folders.
Create a separate home partition
If you are tired of wiping data when changing Linux distributions, you want to create an extra ext4 formatted partition. The first should have "/" (the root folder) mounted, and the other partition should have "/ home" mounted. All your personal data are saved in the "/ home" folder, ie all your personal data are saved in the second partition.
Once you're ready to switch Linux distributions or upgrade, you can delete the first partition that contains the operating system and your installed applications. However, the second partition with all your personal files and settings can remain untouched.
When you perform the new Linux installation, you can tell the installer to reformat the first partition (to start over), but leave the second partition alone and simply mount it to "/ home". Then all you have to do is make sure that you have the same username and password as before and that everything is as it was.
Detaching your partitions does not prevent you from encrypting your drive
4 reasons to encrypt your Linux partitions
The only thing left to do is reinstall your applications, but you don't have to reconfigure many of them because their settings were saved along with your other personal files.
Precautions when changing Linux distributions
A possible disadvantage is that keeping previous settings when switching between distributions can lead to incompatibilities. Although Fedora and Ubuntu both use GNOME as the standard desktop backend, the implementation of Ubuntu is very different and the settings of Fedora can become confusing. Be careful.
Make sure you give the two partitions enough space when you give them space. If your first root partition is very small, you won't be able to install many applications. If the second partition is too small, you don't have much space to store your personal files. The partition sizes are hard limits.
I would recommend allocating at least 15 or 20 GB of space to your first partition if you don't plan to install many applications.
If you plan to install many applications or games (which take up a lot of space), you should use 50 GB. Players should watch the games they want to install and add up how much space each one uses.
If you find that your partition sizes are not suitable for your use, you can resize them by booting into a live environment and running a partitioning tool or using the command line
Take control of Linux hard drive partitions with these 10 fdisk commands
Do you already have Linux installed?
Don't worry if you already have a Linux installation installed and everything (including your home folder) is on the same partition. It only takes a few steps to achieve the desired setup. The steps are as follows:
- Download the ISO of the live environment of your favorite Linux distribution and burn it to a CD / DVD or write it to a USB drive.
- Start your newly created media. Use a partitioning tool like GParted to resize your ext4 partition to the size you want.
- Use the same tool to create a new ext4 partition in the blank area created by resizing the first partition. Make a note of which partition it is. It should look like this / dev / sdXY, Where X. is a letter that designates the drive and Y. is a number that designates the partition. An example is / dev / sda2.
- Mount both partitions and copy the contents of the base folder to the new partition. Make sure that you copy the entire contents of the base folder and not the base folder itself. Otherwise, all of your content is in "/ home / home / user", which doesn't work.
- Now open a terminal and execute the command gksudo gedit to open the Gedit text editor. Now use the menus to open the file at / etc / fstab in the first partition.
- Add the following line to the end of the file: / dev / sdXY / home ext4 error = remount-ro 0 1. Again, make sure that / dev / sdXY is replaced with the actual label for the partition.
- Save it and restart it. Make sure to remove the live environment media so that you can go back to your regular installation.
Switch to Linux Distros without losing data
The difference is not obvious, but your personal information is now on a separate partition, which does not stand in the way of changing distributions or performing upgrades.
The separation of partitions is not only intended for Distribution Hopper or to reduce the effort when upgrading to a new version. A separate partition can help if you download updates that leave your PC in a state where it won't start. Simply reinstall a Linux version on the root partition and you can get started again without having to back up and restore a series of files.
If you're feeling more encouraged now to try other Linux versions or take a few risks, here's our list of the five latest Linux distributions
5 Linux operating systems that offer current updates
. Just make sure that your personal information is backed up regularly, even if it's now on a separate partition.