How to Recover Deleted Files Using TestDisk in Linux – Guide
If you accidentally deleted a file on your Linux system, Testdisk can help you recover it. Testdisk is a disk recovery tool that can help you recover lost or damaged partitions, reset unbootable disks, and more. Although testdisk has a wide variety of features, including recovering lost or damaged partitions and resetting unbootable disks, it is also widely used to recover files that were accidentally deleted. So if you’re looking for a disk recovery tool that can help you Recover files that were accidentally deleted on your Linux system, Testdisk may be the right choice for you.
TestDisk is a powerful and reliable data recovery tool that can be used to recover files from partitions caused by human error or virus. It was written in the C programming language by Christophe Granier, and is available on almost all other operating systems.
Recover Deleted Files on Linux with TestDisk
The first step to recovering deleted files is to create a log file. TestDisk logs are important as they store essential information related to data and partition recovery. Even in general, users should prioritize the system log to get information about the activities happening on their computer. ..
Create a log file
testdisk -l This will list all the files and folders on your computer.
The system will display the output as follows. You can choose from three options: Create, Append and No Log.
Create a new log file for TestDisk. This file will be used to track the progress of the TestDisk operation.
Used to add additional information to an existing log file.
The No Log: TestDisk command will not use a log file for the recovery process. This is to ensure that your data is not lost in the event of a data loss.
Choose the recovery drive
After creating a log file, you need to choose which disk drive to recover data from. The screen will display information associated with each drive on your system, including the drive name and size. ..
The TestDisk drive is the best way to test your computer’s disk space.
Choose partition type
- FAT32: This type of partition is used for FAT files, which are small files that store data in the form of text and images. FAT32 partitions can be found on most computers.
- NTFS: This type of partition is used for NT files, which are large files that store data in the form of folders and subdirectories. NTFS partitions can be found on most computers.
- EXT4: This type of partition is used for EXT file systems, which are larger than FAT32 but smaller than NTFS. EXT4 partitions can be found on some servers and laptops.
- MBR: This type of partition is used for Master Boot Record (MBR) files, which are important because they contain information about the computer’s BIOS and how to start it up. MBR partitions can be found on most computers.
- GPT: This type of partition is used for GUID Partition Table (GPT) files, which are important because they contain information about the computer’s hardware and how to format it so that it can be used with Windows 7 or later operating systems. GPT partitions can be found on some computers but not all ones.
- JBOD: A JBOD (Just-In-Time) disk contains all the data needed to install a new operating system onto a hard drive but does not include any programs or data from an earlier version of the computer or any user data that may have been stored on other disks inside the hard drive before installation began—this is different from traditional hard drives where programs, user data, and old disk contents are combined into one single disk image called an OS installation disc). A JBOD partition cannot be recovered using TestDisk because TestDisk only recovers FAT32 partitions
If you want to restore deleted files, choose Advanced from the list. ..
The system will list all available partitions on the selected disk. If you are using an HDD, it is likely that the system will display multiple partitions. On the other hand, if it is a removable media drive, TestDisk will only display a single partition.
If you choose to store the partition image file in a directory other than the one you specify, TestDisk will ask you to choose a directory to store the partition image file. Choose an appropriate location and select Continue.
Navigate to the deleted files directory
TestDisk will now display all files and folders stored on the selected partition. Change to the directory that contains the deleted file. For example, if the /Desktop directory contains the file, navigate to that folder.
If you do not find any deleted file entries, unfortunately your files cannot be recovered. However, if you found file entries with red font, you cannot simply “restore” those files using TestDisk. What you will have to do is copy the deleted files and paste them in another directory.
To copy a file, highlight the file and press C on your keyboard. Now, navigate to the directory where you want to paste the file and press C again to paste. If the system successfully copied the file, you will receive a notification that the copy is complete!
Exit the application by selecting the Exit option on the screen. The system will take you back to the previous screen. Again, continue selecting Exit to return to the previous screen. It will take a few rounds to highlight and press Enter to close TestDisk completely.
Final note
If you’ve deleted files on your computer using Windows, Mac, or Linux, TestDisk can help you recover them. TestDisk is a free software tool that can be downloaded from the Internet. ..