momius - Fotolia
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.
During the manual partition, you must create two separate partitions: one for / and one for /home.
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.
Make troubleshooting in Linux easier
What's the best Linux distribution for your servers?
Find out the right Linux OS for your data center
Dig Deeper on Data center ops, monitoring and management
Related Q&A from Jack Wallen
Help! I deleted a Linux boot partition
I deleted a partition on my Linux system, but I still see a boot menu. How do I re-install GRUB2 and not lose data? Continue Reading
How do I configure vSphere HA for automatic failover?
I want to install a virtualization environment with physical servers for failover and a storage server to boot up some virtual servers in our network... Continue Reading