Q
Problem solve Get help with specific problems with your technologies, process and projects.

How can I prevent data loss during a Linux distribution upgrade?

It's important to prevent data loss during a Linux OS upgrade. How can partitions or disk drives help IT teams meet that goal?

The flexibility of Linux allows you to customize the operating system based on your needs, and to support different...

desktop and server environments. Once you delve more deeply into Linux, you can discover more of its benefits, such as the ability to easily perform a Linux distribution upgrade without losing your data.

The traditional method

During initial Linux installation, create a specific partition to house the /home directory. Home is a special directory in Linux that stores all user data. When you separate the /home partition from the root partition, which contains the operating system and is denoted by /, you can safely do a full Linux distribution upgrade without losing user data.

Do a manual partition during Ubuntu installation.
Select a manual partition during the Ubuntu installation.

During the manual partition, you must create two separate partitions: one for / and one for /home.

Create the partitions for an Ubuntu scheme.
Create the necessary partitions for this scheme.

With this partition scheme in place, you can easily do a fresh install of Linux. Instruct the installer to reformat and install on the first partition -- the one used for /-- to leave the second partition used for /home untouched.

An alternative approach

A different way to prevent data loss during a Linux distribution upgrade is to save all data to a completely separate drive. You can have multiple disks on one machine; one disk dedicated to the operating system and other disks for specific types of data, such as one disk for office files and one for backups. After you install a new operating system, map the various locations so that "Documents," for example, will point to the drive containing documents. Some file managers allow you to remap those locations. If not, you can either create bookmarks in the file manager or add symbolic links that point the default directories to their alternatives. To create a symbolic link, issue the command: ln -s /path/to/directory /link/name

Let's say you have a disk housing your documents that mounts at /media/jack/DATA/Documents and you want to create a symbolic link named /home/jack/Docs. The command for this would be: ln -s /media/jack/DATA/Documents ~/Docs. There's one caveat to housing your data on a completely separate disk as opposed to a separate /home partition: When you perform a Linux distribution upgrade, you must remember to save any configuration files in the /home/USERNAME directory, where USERNAME is your Linux username.

The latter approach is even more foolproof than the traditional method. As long as you remember to select the correct drive for installations, your data is safe. You can even go one step further and unplug all of your data drives during an installation to ensure no data is lost.

Whichever approach you take, you can isolate your user data from the primary partition and prevent data loss. You can use both of these approaches for other types of data, such as databases and websites.

Next Steps

Make troubleshooting in Linux easier

What's the best Linux distribution for your servers?

Find out the right Linux OS for your data center

This was last published in April 2017

Dig Deeper on Linux servers

PRO+

Content

Find more PRO+ content and other member only offers, here.

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Join the conversation

1 comment

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

Which approach do you take to upgrade Linux distributions without losing data?
Cancel

-ADS BY GOOGLE

SearchWindowsServer

SearchEnterpriseLinux

SearchServerVirtualization

SearchCloudComputing

Close