testdisk saves the day

2007 March 15
by dimeotane

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

6 Responses leave one →
  1. 2007 May 29
    thomas permalink

    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. 2007 June 8
    orlandus permalink

    $ which testdisk
    /usr/sbin/testdisk
    $

    Thomas,

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

  3. 2007 July 2
    Iain Donald permalink

    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. 2007 July 9
    anon permalink

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

  5. 2007 July 28
    Smo3 permalink

    Just type $ sudo testdisk in terminal and program will run ;)

  6. 2008 August 19
    Feri Ametia permalink

    Thanks for the information.

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

    Thanks

Leave a Reply

Note: You can use basic XHTML in your comments. Your email address will never be published.

Subscribe to this comment feed via RSS