Harsh Vakharia

Recover deleted data using TestDisk on Ubuntu

1. Introduction

TestDisk is an amazing data recovery tool available for Linux, Mac OS X and Windows under GNU General Public License v2+.

TestDisk can -

For more details, http://www.cgsecurity.org/wiki/TestDisk

2. Installation

To install TestDisk on Ubuntu,

apt-get install testdisk

You will need root privileges to install it, append sudo to invoke it as a root.

3. Recovery

Open a terminal,


Be sure to run it with root privileges by appending sudo.

TestDisk: Select log file option

Select Create using arrow keys and press enter. This will create a log file for further inspection purpose.

TestDisk: Select device

Now, select device you want to recover, and then Proceed.

TestDisk: Select partition type

TestDisk will suggest you the partition table type of your drive, select it.

TestDisk: Select advanced option

Now, select Advanced. You will see a partition table for your device.

TestDisk: Select partition

Select a partition you want to recover, and navigate to Undelete form the bottom of the screen and select it.

TestDisk: Select deleted data

Found what you were looking for? Navigate to your deleted file or directory and press c.

TestDisk: Select destination

You will be asked to provide destination location where you want to save this deleted file, go there and press c to begin copy.

TestDisk: Success

If you want to recover all the data in a directory, press a to select all the files and then Shift + c to copy all the selected files to your destination directory, then provide destination directory, and press c to begin copy.

When you’re done with recovery, press q to quit.

Got any questions or comments? Drop me a message on Twitter @harshjv or comment below.

Fork my blog on GitHub