Recover Deleted Data on a Linux System

Loss of data is one of the most stressful and painful experiences a user can have. The fear of never being able to recover valuable data once it has been erased or lost causes worry and leaves consumers powerless. But don't take tension; there are some software and ways available that help you recover deleted files on your Linux workstations.

The best method to recover data from the "Trash" directory using a Graphical User Interface. Another way is by installing Test Disk software through the Command Line Interface.

Here at LinuxAPT, we shall look into how to fix data loss problem on Ubuntu Linux system.


Different ways to Recover Deleted Data on a Linux System:

  • Recover Deleted Data on Ubuntu using Trash directory.
  • Recover Deleted Data on Ubuntu using Test Disk.


a. Recover Deleted Data on Ubuntu using Test Disk

1. Open Trash directory

Click on the "Trash" directory.


2. Restore the file

Now select the file from the trash directory which you want to recover and click on the "Restore" button.

Now the restored file will be removed from the Trash director and stored back from where it is deleted.


b. Recover Deleted Data on Ubuntu using Test Disk

Test Disk is one of the useful approaches to the data loss problem. Test Disk is a free and sophisticated data recovery application that rebuilds and restores boot partitions and updates partition tables, among other things. It recovers deleted data from a variety of file systems, including FAT, exFAT, ext3, ext4, and NTFS, to name a few, and copies them to a new spot. One of the characteristics that distinguish Test Disk from other data recovery applications is that it is a Command-Line data retrieval tool.

1. Perform System Update

Before installing any software firstly, you need to update your package list, run the below-mentioned command to update all packages:

$ sudo apt update


2. Installation of Test Disk Software

Now run the given below command to install the Test Disk recovery software:

$ sudo apt install testdisk


3. Check installation

Run the given below command on the terminal to check that the Test Disk is successfully installed by checking its version:

$ testdisk --version


4. Recover file using Test Disk

First, open the Test Disk file by the below-mentioned command:

$ sudo testdisk 
  • Now from arrow keys move to the "Create" option and press Enter.
  • You can recover a file from an external USB device "Kingston DT 101 G2" connected to my virtual machine so by arrow keys move down to it and then from down options move to "proceed" option and press Enter.
  • Now move to the "None" option for external devices.
  • Now the "FAT32" partition is available. Move to the partition and from the bottom move to the "Undeleted" option and press Enter to see all deleted and undeleted files and recover the deleted file.
  • The files in "red color" are deleted files that can be recovered. 
  • Now select the destination where you want to copy the file and press "C" after selecting the correct destination.
  • Now the file is copied successfully.


[Need help in fixing Linux system issues ? We can help you. ]

This article covers the recovery methods of deleted data in Ubuntu (Linux OS). Data loss is a major problem that causes a lot of stress but there are many recovery tools that help to recover lost data. 

Related Posts