testdisk saves the day
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

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
$ which testdisk
/usr/sbin/testdisk
$
Thomas,
It’s not a GUI-based program. You run it in a terminal window by typing “testdisk”.
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.
It can be found via terminal.
Just type ‘sudo testdisk’ to launch it.
Just type $ sudo testdisk in terminal and program will run
Thanks for the information.
can you explain how to install tesdisk on ubuntu, because i always failed when install it…
Thanks
sudo apt-get install >name here<
it's that easy
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!
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.
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.
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.
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
Program really works.