How to recover deleted files from linux server

Introduction

When we delete anything from our system, the data is not removed until the space occupied by the deleted item is overwritten by another piece of data on the disc. Several robust open-source data recovery tools recover your data, rebuild and restore boot partitions, and repair partition tables. These tools may be found online. It recovers files deleted from filesystems such as FAT, exFAT, ext3, and ext4, to name a few, and moves them to another place.

Where Do Deleted Files Go in Linux

In Linux, deleting a file or directory does not always imply that the data can never be recovered again. Before completely disappearing from your computer system, the files that you delete move via many levels of directories where they might be stored temporarily.
They might be user-created, corrupt, out of date, or contain important information. Deleted files and folders may continue to take space on your hard drive long after removing them, even though the disc seems “empty.” This is true regardless of the cause for the deletion.
When files are deleted under Linux, they are often moved to a specific folder called the “trash can.” In the system, the folder may be found under the name “TRASH,” One does not need to turn on the option to display hidden folders to access it.

Using TestDisk Linux to Recover Deleted Files

Were you able to locate your file in any of our searches? You may have erased your file irretrievably by using the Shift key in conjunction with the Delete key or by executing the rm command.

Recover Deleted Files on Linux With TestDisk

The process of retrieving files that have been erased begins with creating a log file. It is necessary to have a TestDisk log file since it will contain critical information related to the data recovery and partitions.

Step 1: Create a Log File

TestDisk is a very interactive program. It will provide you with various alternatives to choose from on every screen. Please note that the following output provides you with three options: Create, Append, and No Log.

Step 2: Choose the Recovery Drive

Following creating a log file, you will be prompted to choose the disc drive from which you want to get the data.

Step 3: Choose the Partition Type

The next thing you need to do is choose the kind of partition you wish to return. If you cannot determine whether the partition is correct, you should just go on with the one that TestDisk highlighted for you.

Step 4: Navigate to the Deleted File Directory

Now that you’ve picked a partition, TestDisk will reveal all files and folders inside that disc. Move your focus to the directory that houses the file that was just removed.

Conclusion

You may search for data on your hard drive using different ways and software tools; however, each circumstance is unique. These circumstances each have their requirements, which can make the whole process more complicated than it has to be to accomplish its goals.