How to Recover Data After Reinstalling Linux or a System Failure

Read this article to find out how to recover data after reinstalling Linux, or in cases when you removed the wrong partition during the installation, when your operating system stops working for some reason, or when it just refuses to boot properly. We’ll show you what to do when you know the files are still on the disk, but you can’t access them.

How to Recover Data After Reinstalling Linux or a System Failure

Very often, it takes some time for people to realize that some important files went missing from their computer after reinstalling the operating system. The, how can we recover data after a system failure, after reinstalling Ubuntu, Mint, Debian or another version of Linux?

Go to view
How to Recover Data in Linux After Formatting a Hard Disk or USB Stick

How to Recover Data in Linux After Formatting a Hard Disk or USB Stick

Peculiarities of Linux installation

So how is Linux installed, and what are the peculiarities of this process?

The Linux installation procedure may vary a bit, depending on the specific version of the software, and there are certain aspects to keep in mind. But generally speaking, when we consider it with recovery in mind, you should mostly focus on disk space management options.

When a computer starts with a Linux bootable drive, users typically have three methods to choose from:

  • The first one is to install Linux along with another, already existing OS (Dual-boot). For example, Windows or MacOS. As a result, you’ll be able to use two operating systems on one computer.

    However, you’ll have to configure disk partitions properly to avoid loss of data.

  • The second method is to “Erase disk and install Linux.” This means cleaning the entire disk and installing only a Linux operating system.

    As a result, all disk data will be lost, so it’s important to back up your stuff before the installation begins.

  • The third method is Manual installation. It is recommended for advanced users who would like to supervise the entire installation process, especially partitioning, file system configuration, and boot options. In the course of installation, users will decide where and how to install Linux, and set up all options.

Three methods to install Linux
Installation method Description Advantages Disadvantages
Next to the available OS (Dual Boot) Installing Linux to the same disk as Windows or another OS, with the option to choose the OS at startup. You can use both OS; no data loss. Partitions should be divided carefully; possible bootloader issues.
Erasing the whole disk The whole hard disk is erased and only Linux is installed. Clean system with maximal performance. All existing data and OS will be removed.
Installation to a virtual machine Linux is installed inside another app (for example, VirtualBox, VMware). No risk for the main OS, convenient for testing. Requires more resources; limited performance.
Live USB (without installation) Boot from the USB stick without actual installation to disk. The new system can be tested while preserving the current OS. Changes are not saved without special settings.
Manual installation (Advanced) Complete control over partitions, file systems, and bootloader. Maximal flexibility and control. Requires certain experience; risk of misconfiguration.

As a rule, data gets lost during Linux installation when users manage partitions, delete the wrong one, or reshape the partition table.

Manual configuration for Linux partitions

So what shall we do when some data is lost as a result of Linux installation? Is it possible to recover it?

Method 1. How to recover data after reinstalling Linux

In most cases when data recovery after reinstalling Linux is involved, we mean the method Erase disk and install Linux. As a result, the installer erases the disk completely and rebuilds the partition table, which makes data recovery quite a challenge.

Let’s suppose my computer had Debian installed, and some files were stored on the disk. For some reason, I chose to reinstall the operating system with the method “Erase disk and install Linux.”

Debian: configuring Linux partitions

To restore the data, I launched a special tool, Hetman Partition Recovery.

The tool recovers data from any devices, regardless of the cause of data loss.
Hetman Partition Recovery: Debian volumes

After a Fast scan followed by Full analysis, this tool couldn’t identify the partitions removed during the installation. The folders containing lost files couldn’t be located, either.

Hetman Partition Recovery: Debian volumes

We got similar results from the other tools we’ve tested – R-Linux and TestDisk.

R-Linux: Debian volumes
TestDisk: Debian volumes

If we scan the disk with Content-Aware Analysis option enabled, which makes Hetman Partition Recovery search for files based on their contents, we can finally locate the lost files in the folder with the same name, Content-Aware Analysis.

Hetman Partition Recovery: Full analysis - Debian

They will be sorted into subfolders by type. That means that the original folder structure and file names will not be preserved. However, if you need to restore a specific file, or a group of files of a certain type (for example, documents or images), this is exactly where you can find them.

Select the items you need to restore and hit Recovery.

Hetman Partition Recovery: files sorted into subfolders by type

Specify the folder where to save them and confirm your decision to recover the files.

Hetman Partition Recovery: the folder where to save data

Now the required file is recovered.

Debian: the lost files are recovered

This is how you can recover as many files as you need. However, to prevent such files from being overwritten in the process, save them to another disk – and not to the same drive that you recover them from.

In the same way, you can recover data lost after installing Linux as the second operating system. It may happen when you planned to install Linux as your second operating system, but made a mistake to choose the wrong partition and installed it accidentally over the first operating system. That is, you did it while using the first method to install Linux – along with another, already existing OS.

Method 2. How to recover Linux data after a failure, or when the operating system won’t boot

What shall we do if there is a computer with two operating systems installed, and one of them is Linux?

On my computer, I have two operating systems installed – Mint and Windows 11. For some reason, Linux Mint can’t boot anymore. The Linux boot partition might have been damaged or removed during Windows installation. So how can we restore the data on Mint, when the access to such information is lost?

When I boot to Windows, the operating system can’t find the Linux disk.

Mint: the lost partition is not showing up in Windows

I can see it in the Disk Management window, but it can’t be accessed. We can only delete it and create a new partition.

Under no circumstances should you do it – this step will make data recovery even more complicated.

Mint: the lost partition in Windows Disk Management

Instead, I launch a data recovery tool, Hetman Partition Recovery and now I can see both Windows partitions and the Linux Mint partitions which can’t be accessed.

The tool recovers data from any devices, regardless of the cause of data loss.
Hetman Partition Recovery: the lost Mint partition

Please take note, that this recovery app can work both in Linux and Windows.

Right-click on the Linux Mint partition from which data should be restored and choose Open.

Hetman Partition Recovery: open the lost Mint partition

Run a Fast scan and wait until it’s over.

Hetman Partition Recovery: Fast scan

As a result, the recovery tool managed to find the files and folders remaining on the Linux Mind partition and which couldn’t be accessed previously. The folder structure and file names have been preserved.

Hetman Partition Recovery: files and folders remaining on the Linux Mind partition

Let’s choose the items to restore and hit the Recovery button.

Hetman Partition Recovery: the Recovery button

Specify the folder where to save them and confirm the decision to recover the files.

Now this folder is recovered, with all of its contents.

Hetman Partition Recovery: Now this folder is recovered, with all of its contents

This is how you can recover almost any amount of data.

Method 3. How to recover data while reinstalling Linux

Let’s suppose you are reinstalling Linux and you suddenly realize there is some important data left on this computer, but it’s impossible to boot the previous operating system now.

To recover them:

  • Start the computer with a bootable drive, and in the window “What do you want to do…” select Try Ubuntu instead of Install Ubuntu (in my case). As a result, the computer will boot from that drive instead of the computer’s hard disk.

    Ubuntu: Install Ubuntu - Try Ubuntu
  • If you go to the Disks tool, you will see the partitions on the bootable drive as well as the computer’s hard disk and partitions of the previous operating system (if you haven’t deleted them yet).

    Ubuntu: partitions of the previous operating system
  • If you look into the user’s folders, you will see they are empty. That is, they can’t be accessed.

    Ubuntu: user folders are empty
  • Let’s move on to the browser.

  • Download and install Hetman Partition Recovery.

    The tool recovers data from any devices, regardless of the cause of data loss.
    Ubuntu: Download and install Hetman Partition Recovery
  • Run this data recovery tool.

  • Here’s the disk of the previous Linux operating system. Let’s scan it.

    Hetman Partition Recovery: the disk of the previous Linux OS
  • If the partitions of the previous system are preserved, a Fast scan will suffice. If they are removed, then run a Full analysis of this disk.

    Hetman Partition Recovery: full analysis
  • Wait until the scan is complete – it may take some time.

  • When the scan is over, go to the folder from which files need to be restored. In my case, this is the Documents folder. That is why I follow this path:

    home/user name/Documents.

  • Here are the files and folders to recover.

    Hetman Partition Recovery: home/user name/Documents
  • Select the necessary items and click Recovery.

    Hetman Partition Recovery: recover a folder
  • Give the path to save the recovered data.

    Please take note that we strongly recommend AGAINST saving data to the same disk where they are recovered from - this decision may get the recovered data overwritten in the process.

    That is why I choose to save the recovered files to a USB stick.

    Hetman Partition Recovery: save recovered files to a USB stick
  • The files are recovered.

    Hetman Partition Recovery: The files have been recovered

Conclusions

Summing up, we have explored three methods to recover data after reinstalling Linux, or when the operating system refuses to boot, for some reason:

  1. The first. After reinstalling Linux with disk erasing.
  2. The second. After installing the second operating system to run your PC in a Dual-Boot mode.
  3. And the third method: when you need to restore data from your previous operating system while installing a new one.

Choose the method that suits your situation best of all.

Vladimir Artiukh

Author: , Technical Writer

Vladimir Artiukh is a technical writer for Hetman Software, as well as the voice and face of their English-speaking YouTube channel, Hetman Software: Data Recovery for Windows. He handles tutorials, how-tos, and detailed reviews on how the company’s tools work with all kinds of data storage devices.

Oleg Afonin

Editor: , Technical Writer

Oleg Afonin is an expert in mobile forensics, data recovery and computer systems. He often attends large data security conferences, and writes several blogs for such resources as xaker.ru, Elcomsoft and Habr. In addition to his online activities, Oleg’s articles are also published in professional magazines. Also, Oleg Afonin is the co-author of a well-known book, Mobile Forensics - Advanced Investigative Strategies.

Recommended For You

Hello! This is AI-based Hetman Software virtual assistant, and it will answer any of your questions right away.
Start Chat