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.)
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.