How to Recover Deleted Files on Linux (With/Without Software)

Linux is continually becoming incredible to use. Besides, most Linux distributions get much easier to install if compared to Windows. 

Despite all this, data recovery on Linux is a little more complicated than on Windows. Not because it is not easy to get hard drive recovery software for Linux, but because most Linux tools run on Terminal. But that should not worry you since that is the reason you are reading this article today. 

Is Linux Data Recovery Possible?

Performing data recovery on Linux is possible. Although access can be more complex when compared to that on Windows, you need to understand the situation before you begin.

In the most local scenarios, undeleting Linux files from Trash is enough to restore deleted files.

However, in most cases you will require advanced tools to recover lost files in Linux.

In this article, we will show you both ways on how to recover data on Linux without data recovery software and how to use them in the process. 

Linux uses filesystems like FAT32, NTFS, and exFAT. With the most popular Linux distributions such as Ubuntu, CentOS 7, Mint etc. however, you are most likely using EXT3 or EXT4 files. 

What matters most is that file recovery on Linux is possible and that we are just about to show you how to go about it. But first things first.

What Should You Keep in Mind Before Attempting Linux Recovery?

Whenever you have lost data from Linux, every single write to the storage device reduces your chances of recovering that data.

This is due to the possible overwrite of your files by new ones. 

We recommend that whenever you have lost data from your Linux, you should unmount the partition containing your files to be recovered and mount it back as read-only.

This should be done before any attempts are made towards data recovery. 

Below is the right command for executing this task:

  • sudo umount/dev/sdc2
  • sudo mkdir/media/device-to-scan
  • sudo mount -o ro/dev/sdc2/media/device-to-scan

To make this much clear:

  • Sudo: The command “sudo” is used in the terminal to execute other commands as an administrator, often referred to as “root.”
  • Umount: The term “mount” is used to connect a storage device to the file system, while “-o ro” signifies that the device is being mounted in a read-only mode.

    “/dev/sdc2” points to the second partition of the third storage device, denoted as “sdc.”

    Finally, “media/device-to-scan” is the location where the second partition is being connected within the file system.

  • Mkdir is used to create the directory “/media/device-to-scan,” which is then used as the mount point when remounting the device
  • Mount -o ro: The command “mount -o ro” is used to attach the device “/dev/sdc2” to the directory “/media/device-to-scan” in read-only mode. This means you can view the data on the device, but you can’t make any changes to it.

Further, you can make your device and data safer by cloning the device you intend to scan to another device, or an image file. 

 

How to Recover Deleted Files on Linux without Data Recovery Software

Like on Windows computers, there are many ways to recover deleted files without software. We can do just that with Linux too using Linux’s Trash. 

Linux Trash is similar to the Recycle Bin used in Windows computers. It is where all the files we delete from the Linux storage system goes first. This is however just some form of temporary storage and must be properly used if you want your data recovery to end well. 

As a temporary storage, deleted files will only stay in the trash for a fixed period. If you go there after this period, your files will be gone. You can access your trash folder from the desktop. 

To recover files from trash on Ubuntu for instance, follow the steps below: 

Step 1: Tap on the trashcan icon available on Ubuntu’s toolbar. This should give you access to the contents of the trash folder through the default manager.

Step 2: Now choose the files or folders you need by highlighting them then right-clicking on the selection to reveal more options. Choose “Restore from Trash.”

That way, you will have recovered all the deleted files back to your internal storage. The process is very simple and straightforward. 

How to Recover Deleted Files on Linux with Data Recovery Software

In this section, we show you how to recover deleted files on Linux with software. Disk Drill developed by CleverFiles, TestDisk, and PhotoRec are just some of the best recovery apps available for Linux. However, you must ensure you are choosing the right tool all the time to avoid data issues. 

Here, we will show you how to use Photorec in the process. This tool will help you out with files deleted temporarily and those that were permanently deleted. Remember that PhotoRec is usually bundled with TestDisk to make customer experience more memorable. Follow the steps below: 

Step 1: Download and install TestDisk. PhotoRec comes with this installation.

Step 2: Launch PhotoRec from your terminal with sudo photorec. 

Step 3: From the media list of PhotoRec, choose the device to be scanned for lost files. Choose “Proceed” the tap Enter. 

Step 4: Highlight the partition that you intend to scan, select “Search” and hit Enter.

Step 5: Select the right file system type for the device preferably ext2/ext3.

Step 6: Select “Free” if you only want to perform a quick scan on the unallocated space, and “Whole” to perform a whole device scan. Remember, the whole scan will be more thorough but much slower. 

Step 7: Choose your preferred directory to send the files after search. Highlight the right one then Enter to recover files on Linux. Give it a few minutes and check if your files are recovered. 

By Steven Smith

Steven Smith is a fanatical writer, blogger, and a devotee. She produces superior articles, how-tos, latest tips and tricks, and reviews. She takes pride in helping businesses through his content. When she’s not writing, she’s probably playing games and watching horror movies.