Using Testdisk to recover lost files from deleted partitions

I installed ubuntu on my home desktop recently. While doing so I choose the “Replace Windows …” option which like title suggests, should have just replaced the windows partition with a ubuntu partition and should have kept everything intact (or so I thought). However, in reality the option is misleading and is actually used to format the whole drive and use all of it for linux. It is like doing a fresh single boot install of ubuntu on your machine. I would highly advise against using this option even though it is the second suggested option (issue with user experience).

In my 500 GB HDD I had 4 partitions:

  • C:\ – Windows, ~50 GB
  • D:\ – Personal files, ~200 GB
  • E:\ – Personal files, ~195 GB
  • F:\ – Backup files ~ Rest

I wanted to just replace Windows and instead have Ubuntu on my C:\ drive. Also, I wanted to keep all my data in the other partitions. However, using the “Replace Windows…” option was disastarous and I ended up with one large linux partition of size ~490GB. I spent the rest of the day, trying to recover parts of my original data.

This is when I found out about testdisk, a utility for recovering files and lost partitions from a device. The utility is suggested in many threads related to solving the exact same problem I was having [1,2,3]. After digging through the step by step wiki as well as going through many other links [4,5,6] I recovered many important files from my partitions. This video guide was also very helpful.

Some important things to note while doing the recovery are:

  1. First go through the following links in detail: and step by step wiki
  2. DO NOT USE the HDD once you realize the partitions were removed or corrupted.
  3. Have another external storage device like HDD or USB stick which can store the data you want to recover.
  4. Have a Live Ubuntu USB Image. [You will need to boot using this and not use the HDD of your computer. ]
  5. Have an internet connection. [Or else you need to have an executable of testdisk with you]
  6. Boot into the live ubuntu and open software and updates, and make sure the “Universe” repository is checked. [3]
  7. Run the following commands “sudo apt-get update” and “sudo apt-get install testdisk”
  8. Once testdisk is installed you need to run it as administrator “sudo testdisk”
  9. Follow the steps in
  10. Quick search might not yeild best results especially if your Ubuntu was installed over your windows partitions.
  11. Try Deeper Search [Be warned this will take a lot of time depending on your HDD size, mine took around 1.5 Hrs]
  12. Once finished it should probably list your original partitions usually with first column of results as HDFS – NTFS.
  13. You can go inside each partition and look at the files using option “P”. You can also mark paritions for deletion or as Logical Drive using the Left/Right arrow keys.

I used the list files option and copied all important files from my partitions to my external HDD. This will take some time depending on the data you need. I recovered ~5000 photos and few 100 documents and ~5000 other files. The process was easy and the external HDD had the correct files stored.

My attempt to recover full partitions, failed with Invalid partition sectors error. However, I was happy with the capabilities of the tool and its user friendly approach. I believe, it would have been possible to recover my partitions as well but I made some mistake on my side.

Overall, testdisk is a great utility and is recommended for recoveing files which you accidently deleted or lost during partition deletion. It is recommended by the Ubuntu data recovery page as well.



Resolve overheating issue for AMD Radeon Graphics Card for GNOME 3.6 in Fedora 18

I have recently installed the Fedora 18 to my HP Envy 4 1002tx laptop which comes with AMD Radeon HD 7670M (2 GB DDR3 dedicated) with GNOME 3.6.2 and after logging in I was facing sever overheating issue and the laptop fan was making heavy noises. The overall battery backup was also getting reduced to some 1 hr 50 minutes.

The overheating was so sever that it was impossible to put my laptop on my lap as it was almost burning my legs.

I posted the issue on various forums and the full description can be found here:

I also tried installing the ATI radeon drivers using all the various methods like:

  • kmod-catalyst
  • akmod-catalyst
  • Official driver for linux from ATI site.

In all cases I ran into config issues because of which I was unable to boot into GNOME. These could only be resolved after deleting the Xorg.conf file.

After using all the 3 approaches above on rebooting I lost the gnome shell and my system will not bring up gnome. After deleting the xorg.conf I was able to get into gnome but was only presented with the downgraded version of gnome in which the system settings feature stopped working.

I like the gnome 3.6.2 interface and would want to stick to it that is why I am still running my laptop in Fedora irrespective of the overheating issue.

So after a little bit of searching I found out that the issue is because of GNOME interface which uses a lot of CPU power. [BUG for this]

In the process I also got to know about the GNOME Shell Extensions where I found a plugin called Radeon Power Profile Manager . I installed it by enabling GNOME Shell in my browser and clicking on Toggling the ON-OFF switch next to the plugin name.

After installing the plugin I just checked if the power management in my machine is set to profile or not. This can be down by:

$ cat /sys/class/drm/card0/device/power_method

After installing the plugin I could see it in my top-bar as an option where I clicked on it and choose the Set profile to “low” option.
Radeon Power Profile Manager Radeon Power Profile Manager
After using this plugin my CPU temperature came back to normal in 15 minutes. And now it it working at a very optimum temperature.


UPDATE: Better method:

The last method was good but somehow I was not seeing significant effects as the extension was crashing after I rebooted. So after a lot of searching I found a better method which has given me better results than the last solution.

All you need to do is run the following commands:

modprobe radeon
chown -R $USER:$USER /sys/kernel/debug
echo OFF > /sys/kernel/debug/vgaswitcheroo/switch

After this you can run sensors. I saw a drop in Physical id temperature from 72 C to 52 C which is quite good.

However the solution is only temporary and will be lost if you reboot. So you can put this script in rc.local and then it will be applied each time you boot into your machine.

Edit your /etc/rc.d/rc.local with the following commands:

#!/usr/bin/env sh

modprobe radeon
echo OFF > /sys/kernel/debug/vgaswitcheroo/switch

And then enable it by running the following commands:

systemctl enable rc-local.service
systemctl start rc-local.service
systemctl status rc-local.service # Check the status if its running or not.

The solution is taken from:

So after days of searching I finally found the solution. Thanks to Stunts for making this plugin available. The full documentation for the plugin can be found at: