Explanation of recovering deleted files in Linux using TestDisk
By Admin
The problem of data loss is really confusing. It may happen that you delete a file by mistake, or due to a computer error, virus, etc. There are many solutions available to recover deleted files in Windows/Mac, while Linux may require other steps, but recovering deleted files in Linux is not difficult and you can recover your files immediately via the distinguished Testdisk program.
Have you ever thought you need to recover these
file as quickly as possible? What if the file is new and has not been backed up? Now don't worry, fortunately, there is something you can do to solve this problem.
In this article, we learn how to recover deleted files on Linux using the “testdisk” program. The process of recovering deleted files in Linux The default system uses “ext” and “inodes” files to retain the data for each file. The “inode” tables contain primary data about the file, such as the name of the file, its owner, and what permissions are granted to others, whether to modify or save, and so on. It also contains entry points to main links that point to the file, and each file contains at least one hard link.
Every time you create a new link, your permalinks increase by one, and vice versa. Every time you remove a hard link, the number of hard links in the inode is reduced by one.
When a file is deleted, the inode is marked as unused (and ready for reuse). The permalink to the file is removed, in which case the file no longer appears in directory listings and cannot be used or accessed. However, the data that makes up the file's contents still exists on the hard drive.
If you can correct the “inode” so that it contains the correct information, the file will be restored. Of course, these attempts will only work if the data that makes up the file on the hard disk remains intact and has not been overwritten. Alternatively, you can create a new “inode”, copy the remaining data from the old inode, and then replace the lost data.
Usually when you delete a file by mistake, it is one of the worst difficult moments, especially when you need that file. You don't have time to rewrite it again, and in addition, if the file is new, it probably has not been backed up, in which case it cannot be restored again.
When this error occurs, the “testdisk” program comes into play. It is an easy-to-use program that does not require detailed knowledge of the file system. Read also: The most important Linux programs for download... 10 Linux programs that we recommend to you. Steps to download and install the testdisk program. A person with little experience in dealing with files can succeed in using it easily and smoothly. Here are now the steps on how to use this program.
Download the file from the official page of the program (download the program). After downloading the program and decompressing the files, go to the folder that was decompressed and click on the qphotorec_win file, after which the program will run automatically as the program does not require any special steps for installation. Or write the following installation code in the terminal editor: sudo apt-get install testdisk Now in the terminal interface we will create a folder to restore files and we will write the following command: mkdir restore Then we will go to this folder by typing the following command to work from there: cd restored/ How to restore deleted files using testdisk Now, by entering the main program window and running it from the Restored folder that we created, the options for recovering deleted files from your device can be specified.
But he will first need to create a log file, so accept the first option in front of you by pressing Enter or proceed to continue. Now you will select the hard disk from which you deleted the files in Linux. For example in this image, it is the “/dev/sda” hard drive, and you will select with the arrows and then press Enter. The program will automatically detect the file system, whether gpt or mbr, and click Continue. Now click on Advanced and the hard disk partitions will appear for you. What we are looking for is the Linux filesystem partition. We will choose it and continue. For example, if the files are in your main account, you will choose Home as in the picture.
Move the arrows on the keyboard to the right or left and choose List and press Enter to show you the list of files. Now all you have to do is choose the user account from which the files were deleted and click on it to show you in red those recently deleted files that can be recovered via Node logs. To restore deleted files, we will highlight the deleted files and then press the letter C to restore them to the Restored folder from which we opened the program in the first step. The program can be used to recover deleted data for many of your personal and system files with ease.
Features of the program “testdisk” The program is characterized by many features, the most important of which is of course recovering deleted files, in addition to the following features: It helps in recovering deleted files that contain photos, documents, and video files. Ability to repair department tables. The ability to restore the boot partition of the operating system to the FAT32, FAT12, and FAT16 partition.
Possibility of recovering most FAT platforms. Repair and detect many errors that affect the computer. The program does not require complicated installation steps.
The program is free and easy to use. It is compatible with all Linux systems in addition to various Windows systems. Read also: Linux Mint or Ubuntu..
Which is the best Linux distribution for beginners?
DROPIDEA
We hope this article has added real value to you. At DROPIDEA, we always strive to deliver high-quality content that helps you grow and evolve in the digital space. Follow us for more useful articles and guides.
Admin
DROPIDEA
Latest Articles
“Nofollow” tag: What it is, how and where it is used, “Infographics”
ASUS ROG Flow Z13 (2025) available: Everything you could dream of in a gaming tablet.
The best 5 sites to download safe computer programs without malware!
Create a forum on WordPress using the bbPress plugin step by step