

Next, we arrow down to the specific home directory. Notice that it looks as if we’re starting in /, but this is actually the base of the file system that we’re working in. Then press the right arrow to select at the bottom and press enter. Partition Start End Size in sectors > 1 P Linux filesys. Analyse current partition structure and search for lost partitions In the next step, arrow down to “ Filesystem Utils”. > EFI GPT partition map (Mac i386, some x86_64.) Please select the partition table type, press Enter when done. Disk /dev/sdb - 500 GB / 465 GiB - SAMSUNG HE502HJ In this example, the deleted file was in a home directory in /dev/sdb.Īt this point, the partition type should already be selected by testdisk. Then tap the right arrow twice and press enter when Proceed is highlighted. Use the up and down arrow keys as needed to move to it. The next step is to select the disk partition in which the deleted file was stored (if not already highlighted). You will then be prompted for your password (unless you very recently used sudo). In this example, we opted to create the log file.

The > on the left and the reversal of the font and background colors that you will see show the option that will be used once you press enter. Here’s how: Use arrow keys to select, then press Enter key: At least initially, it’s a good idea to create the log file as it provides information that might prove useful. The first page of information presented by testdisk describes the tool and displays some options. Make sure you can write in the directory you select to start in.

Once the files are successfully restored and verified, they can be moved back to where they belong and have their ownership restored as well. For this reason, I like to start in a directory like /home/recovery. When you recover deleted files with testdisk, you’re going to end up with the files being restored within the directory form which you started the tool and the files are going to belong to root. If you don’t have sudo access, you’ll get kicked out early in the process, and your logfile, if you chose to create one, will end up with a message like this in it: TestDisk exited normally. Recovering filesįirst of all, you have to be logged in as root or have sudo access to use testdisk. Interestingly, it’s not just a Linux tool but is also available for MacOS, Solaris and Windows as well.ĭocumentation is available at. Install testdisk with commands like apt install testdisk or yum install testdisk.
