3 Ways to Switch Linux Distros Without Losing All Your Data

by
0 comments
3 Ways to Switch Linux Distros Without Losing All Your Data

porcorex/iStock/Getty Images Plus

Follow ZDNET: Add us as a favorite source On Google.


ZDNET Key Takeaways

  • Moving to a different distro doesn’t mean you have to lose data.
  • There are three options you can try.
  • Be sure to test them before doing this.

Are you feeling the eternal pull to move to a different Linux distribution? it happens. I have gone through that experience so many times that I have lost count.

Moving from one distribution to another is not that hard… unless you want to retain all the data in your home directory (or any directory for that matter). If you do nothing to save that data, you will lose and have to start everything over.

Also: I replaced Windows with Linux, and there’s only one feature I miss

You don’t want that (unless there’s nothing important in your home directory).

What you can do depends on your setup and needs.

Let me explain.

Best way to change distribution and keep your data

Linux is so well designed that you can install the operating system in such a way that your home directory can be easily moved from one distribution to another.

How you do this is to partition the distribution so that your home directory is on a separate partition from the OS.

Also: This is my all-time favorite Linux distro – and I’ve tried them all

Sounds difficult, right? It really isn’t.

Let me show you the basics of how this is done, performing it on the latest release of Ubuntu. Before starting the installation, you should either ensure that your machine has a second disk or connect an external SSD (with a cable fast enough to handle the data transmission). To do this, move through the installation as normal until you reach the Disk Setup section.

When you’re shown two ways to set up your disk, select “Manual Installation.” In the resulting window, you should see your drives listed. If you have a secondary drive, that should be listed as well.

Also: My 5 Favorite Linux Distros That Are Ready To Use Out Of The Box (No Setup Required)

Select the secondary disk and then click +. When prompted, configure the size you want to use for the /Home partition, select /Home from the Mount Point drop-down, and then click OK.

After that, repeat the process, only this time select the primary drive, click +, and configure the mount point as /. Make sure you allocate the space you want to the partition (possibly the entire drive), and click OK and then Next.

At this point, complete the installation as you normally would.

Now that you’ve configured your /home partition on a separate disk, you can hop the distribution whenever you want, ensuring that the OS is installed on the primary drive.

‘other’ method

Another way to save your data is through backups. That’s right, the old backup routine.

As far as backing up /home, you don’t want to backup the entire directory. Instead, back up your user directory within /home (like /home/jack) to an external drive (even a USB flash drive). You can either backup everything in that directory, or backup only the folders that contain the data/files you want to save.

However, keep in mind that there are hidden folders that contain app configuration, cache, and other bits. Because of this, I would recommend backing up everything in your home directory.

Too: I’m a command-line pro and thanks to the AI, this is the best terminal app I’ve ever used

If you’re not sure which backup tool to use, I recommend Déjà Dup, TimeShift, or Lucky Backup (each of which can be installed from the standard repositories).

Once you’ve taken care of that, be sure to backup any other important data, although on the desktop machine the most important data will be in your home directory.

Now you can install the new OS. I would make sure to create your home directory on the secondary drive so you don’t have to go through it the next time you mount.

After the installation is complete, reboot, connect the drive holding the data, open your file manager and start copying things.

Too: My Top 5 User-Friendly GUI Backup Tools for Linux Desktop (And Why You Need One)

Do not copy your user directory from the secondary drive to the /home directory on the primary drive, as you may encounter permission or ownership issues.

a third option

There is another option which is a type of hybrid. Let’s say you’ve copied your important directories from your /home to an external (or secondary internal) drive.

Too: Do you want to save your aging computer? Try These 5 Linux Distributions

Instead of copying those directories, you can simply link them. Let’s say you’ve copied everything in ~/Documents to a secondary drive that’s mounted at /media/jack/drive1/, and you want to link your ~/Documents directory to it.

First, delete the ~/Documents directory (assuming it’s empty) with the command:

rm -rf ~/documents

Next, issue the following commands from your original home directory:

ln -s /media/jack/drive1/documents /home/jack/drive1/documents

You should now see a new ~/Documents directory, which contains everything in /media/jack/drive1/Documents.

And there you have it.

My final suggestion is that you test these methods on an additional machine. Also, no matter which route you choose, always back up your data.

Related Articles

Leave a Comment