I made a big mistake last night. I deleted all my families photos by mistake. But, I didn't panic because I love Linux and I love Linux utilities :)
I was changed my operating system and I clearly sure I was take backup from my hard drive before it. But, my new operating system booted and I see nothing at my backup place. I googled my problem and some peoples tell testdisk is the right chose to solve my problem. OK, I downloaded it and really works. Let's see how it works.
First of all, download the software from your package manager. I'm using APT. Same for you if your system is Ubuntu or Debian based. After that, you can run the "sudo testdisk" command on your terminal.
I will create a new log file at this session. Just press 'enter'.
testdisk showing our hard drives to us. You must chose a drive of the list which is the contain lost data you want to recover. My lost data is in /dev/sda. So, I just pressed 'enter' again.
These are partition tables. testdisk automatically detect and select our partition table on selected drive. Just press 'enter'.
These are our options on the disk. I selected 'Advanced' section for recover my lost data.
Select what you want from options of the bottom. I selected 'Undelete' option for recover data.
Deleted files printed color red. I want to recover "lost_data" file. Use arrow keys to select your lost file or files and press 'C' or 'c' key for copy the files.
testdisk asking destination to us for the copying files. I will just press 'enter' because I want to set destination folder to home directory. And you done, you can use the 'q' key for exit.
Your recovered data owner is will be root user. You can solve this problem with following command.
sudo chown -R $USER:$USER lost_data
Well, that is all.