Every time I lose my precious data, I wish I could be Dr Strange and have the power to turn back time. Data loss is one of those things that people think cannot be ‘Undone’. While there are lot of ways you can lose your data, they are many ways to recover them too.
In this tutorial we will use TestDisk, a data recovery software that recently helped me from trouble. TestDisk has been around for a while, works like a charm, and does a whole lot of stuff without even a flashy GUI. Turns out it is in the the official Ubuntu repositories which ship with Ubuntu 16.04. (It’s also available in the Arch Linux Extra repo.)
TestDisk is Here
If you go through TestDisk’s website, it says that this program is designed “to help recover lost partitions and/or make non-booting disks bootable again when these symptoms are caused by faulty software: certain types of viruses or human error (such as accidentally deleting a Partition Table).” In this article i have explained what happens to your data when you delete it. Actually the data still stays there, but the location of data is named as null but not overwritten(usually).
You can use this software as a saviour of your Windows or Linux partitions, but you’ll need an Ubuntu live USB drive so you can boot into a separate environment on your PC, and then retrieve the lost files. With Ubuntu running, install TestDisk using the command sudo apt-get install testdisk. You’ll need to run it with administrator privileges: sudo testdisk.
On the first run, TestDisk will ask if you want to start a new log file. (You probably do.) From there, the program will look for any drives automatically. If no drives are found, you’ll need to specify the block device as an argument to TestDisk, e.g.: sudo testdisk /dev/sda. If you’re unsure about where the drives you’re looking to recover are located, use the command lsblk to get more information.
Once you see the drives, TestDisk will try to automatically detect the partitions, including those that have been deleted. TestDisk will also look for file entries automatically, though damaged or deleted partitions will require a deeper scan. The deeper scan will take some time, since TestDisk will read the entire partition, block by block. Once the scan is done and you see all the files, you can copy the files to backup media (like you, err, I, should