Skip to content

testdisk saves the day

March 15, 2007

Wow, this quick and easy to use package saved the day! Mark this one down for your future emergency reference just in case. This disaster story has a happy ending!

What happened to me was that I started off with using the cp command to copy files directly from a ntfs drive to a usb drive (which had a brand new ext3 partition). The transfer started nicely, however the speed was quite slow and to copy 100GB was going to take about 4 hours by my estimates.
So I restarted with a faster solution. I used the helix boot CD to run AIR: Automatied Image and Restore (a graphical frontend for dd). DD managed to transfer at about 25MB per second. Copying the 180GB hard drive took about 2 hours and 10 minutes. It copied the data nice and fast but I guess in the process I probably did it wrong and borked the partition table.
So I move my usb hard drive to another computer and plug it in. Not only does it not autodetect the drive when I plug it into ubuntu, but when I try to mount the drive as NTFS I get the error: “mount: wrong fs type, bad option, bad superblock on /dev/sdb”. I try out the dmesg | tail suggestion and I read this error message in the output : “[17190438.380000] NTFS-fs error (device sdb): read_ntfs_boot_sector(): Primary boot sector is invalid.” Yikes, what to do… good thing I just didn’t delete the old data on the other pc yet! I look around on the net for a solution. Is there a fsck.ntfs out there? Not that I can find. How about a package to fix the partition table I wonder…. Someone else had posted on a forum that testdisk had ‘saved their butt’ too many times to retell. I read on about teskdisk to find out more. Sure enough testdisk is described as :

…powerful free data recovery software! It was primarily designed to help recover lost partitions and 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 your Partition Table). Partition table recovery using TestDisk is really easy. It works with the
following partitions: FAT12, FAT16, FAT32, Linux, Linux swap (version 1
and 2), NTFS (Windows NT/W2K/2003), BeFS (BeOS), UFS (BSD), JFS, XFS,
and Netware.

Sounds just like what I needed. So I ‘sudo apt-get install testdisk’ and run it. Pure magic! Idiot proof! It took a few minutes to detect and scan the partition I write the fixed partition table and get on with my day. Thanks to Christophe Grenier!

Visit the home page of testdisk here

13 Comments leave one →
  1. thomas permalink
    May 29, 2007 6:19 pm

    I have installed testdisk on my Ubuntu system, I have no idea where the program is? its not in Debian menu or administration? Any ideas? thanks

  2. orlandus permalink
    June 8, 2007 7:19 am

    $ which testdisk


    It’s not a GUI-based program. You run it in a terminal window by typing “testdisk”.

  3. Iain Donald permalink
    July 2, 2007 5:47 am

    I had a similar problem, ran this program and BAM, fixed it. Great utility, unbelieveably easy to use.

    Just type testdisk from the terminal to run it.

  4. anon permalink
    July 9, 2007 11:56 am

    It can be found via terminal.
    Just type ‘sudo testdisk’ to launch it.

  5. Smo3 permalink
    July 28, 2007 8:29 pm

    Just type $ sudo testdisk in terminal and program will run πŸ˜‰

  6. Feri Ametia permalink
    August 19, 2008 5:51 am

    Thanks for the information.

    can you explain how to install tesdisk on ubuntu, because i always failed when install it…


    • Dreamglider permalink
      November 11, 2009 8:12 am

      sudo apt-get install >name here<

      it's that easy πŸ™‚

  7. Etherealman permalink
    May 15, 2010 7:22 am

    Every once in awhile a program will drop right out of the heavens and into the lap of us mere mortals. This program is one such Godsend. Thank you Christophe Grenier! Thank you! My bacon is saved!

  8. Matt permalink
    June 3, 2010 8:53 am

    I know this thread is old but… the program still works and you should use synaptic package manager to get it.
    TestDisk is awesome. I took my wifes dead hard drive from her window’s machine to several local computer stores and the “squeak squad”. I was quoted prices of 300-1000 dollars with no promises. They all told me they would have to send it to a special “lab” to recover the data. I used the “freezer trick” to get the disk spinning again (yes it works) and was still quoted at least 300 dollars to recover the data. To make a long story short I’d like to thank my freezer, Ubuntu(Linux), and TestDisk(cgsecurity) for saving 298 gigs worth of family pictures, videos, music, etc. and making my wife happy.

  9. Neeraj permalink
    June 29, 2010 10:39 am

    Amazing software. Had lost a data file which had details of my financial transaction of last one year. If it hadnt worked would have required almost 2-3 days to go through all the bills, details etc. really amazing.

  10. Neeraj permalink
    June 29, 2010 10:40 am

    for the gui ppl its very easy to find in synaptic, install it and then run it from terminal. has a very easy menu which is quite easy to understand for a novice like me.

  11. rob: freeman permalink
    May 8, 2011 6:23 am

    Mega panic! Installed Ubuntu on my other half’s PC to run alongside XP as I want to wean her off Microcrap and make the permanent move to Linux (Ubuntu is great and Linux has moved forward in leaps and bounds from when I started messing with it 10 years ago). Must have clicked the wrong thing during install and found Ubuntu had overwritten the Windoesn’t format. Aaaaaargghh! Wife has all her pics and personal files from 10 years on the hard drive and hadn’t backed them up as I kept telling her to. Pointing out her failings only worsened situation and I was staring into a bleak future of no physical gratification or other services from said angry wife. Then I found TestDisk! Yeeehaaa. I’m a relative Newbie with Linux terminal and this was a doddle to use. All files recovered (with directory structures and file names intact!).

    To whomever wrote this package I prostrate myself before ye. One marriage saved. One happy wife. One happier hubby. Many many many thanks!

    Now I can gloat about her not backing up her important files! mwahahahahahaha πŸ™‚

  12. Anna permalink
    May 29, 2011 8:00 am

    Program really works.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: