That was a demonstration of how you can recover deleted files in Linux using the TestDisk utility.
To exit TestDisk, press ‘q’ repeatedly until your finally go back to your bash shell. $ sudo chown linuxtechi 'Cover letter.txt' 'How-to-get-CLIENTS-to-say-YES.pdf' You can change the permissions with chown command. The recovered files are saved with root permissions and ownership. To confirm that the files have been copied, head over to the destination directory and confirm that the files exist. TestDisk will notify you that the files have been successfully copied. You can choose any option, and once again, press ENTER. The modification dates of the target directory will be displayed. Once you have selected your directory, press ENTER. In this example, we have chosen to save the files in the ‘ Public’ directory. You will be prompted to select your preferred destination to save the files. Now press SHIFT + C for capital ‘C’ to copy the files. You will discover that each file is highlighted in green.
So, scroll down and type a full colon (:) for each selection. To recover these files, you need to select them first. TestDisk scans your drive for undeleted files and highlights them in red. Your removable drive’s partition table will be listed as indicated. For non-partitioned disks such as USB drives, a non-partitioned media type will be detected. TestDisk automatically detects the partition table type. Using the arrow forward key, select ‘ Proceed’ and press ENTER. In our case, we have selected out removable USB drive. Now, this time around, all the mounted partitions will be displayed. NOTE: To avoid the hassle, you can simply run testdisk utility as a sudo user from the terminal.
Therefore, using the arrow forward key, select ‘ sudo’ and press ENTER. However, to view all the disks and partitions, you need sudo permissions. The next screen presents you with the mounted volumes. By default, it highlights the most logical option to take as you get started out. On your terminal, run the following command to launch TestDisk $ testdiskīeing a command-line tool, TestDisk provides a list of options as shown. You can have a similar setup where you have deleted a few files on your pendrive/ usb drive. The files are not even in the trash bin and our objective is to recover them. To demonstrate how you can recover files deleted from a Disk, we have deleted two files from a USB drive. Step 2) Recover deleted files using TestDisk $ testdisk -versionįrom the output, you can see that we have installed TestDisk 7.1 Now, let’s simulate how you can recover deleted files from a drive. Once installed, you can verify that Testdisk is installed by checking the version of TestDisk as follows.
To do so on Debian/Ubuntu distributions, update the package lists and install TestDisk as follows. Step 1) Installing the TestDisk utility tool We will demonstrate how TestDisk can recover deleted data from a removable USB drive in Ubuntu 20.04. In this guide, we will demonstrate how you can recover deleted files in Linux using the Test disk utility tool. TestDisk is a command-line data recovery tool, and this is one of the attributes that sets it apart from other data recovery tools. It recovers deleted files from filesystems such as FAT, exFAT ext3, ext4, and NTFS to mention just a few, and copies them to another location. TestDisk is an opensource and powerful data recovery tool that, apart from recovering your data, rebuilds and recovers boot partitions and fixes partition tables. We have tried out a few data recovery tools that can help you get back your deleted files and one that stood out among the rest.
Thankfully, there are a couple of tools that you can use to recover deleted files on your Linux machines. The prospect of not ever finding precious data once it is deleted or lost is what usually inspires anxiety and leaves users helpless. Losing data is one of the most unsettling and harrowing experiences that any user can go through.