Recovering Files From an Unmountable USB Key

The other night, myself and Rory managed to recover his friend’s thesis from a wonky USB thumb drive. We used PhotoRec on Ubuntu Linux. PhotoRec comes with the TestDisk utility. You can install TestDisk via:


$apt-get update
$apt-get install testdisk

The first thing we did was run dmesg in a terminal to get a bit of info on what was going on. We ran dmesg before and after we plugged in the drive and noted the relevant output. The device eventually settled and was given the device location sdb by the kernel, but no filesystem was found.
The partition was likely corrupted somehow.

TestDisk could be used to try to repair the partition on the disk, but it could also damage the data further. We decided to make an image to work with using dd:


$sudo dd if=/dev/sdb ou=./disk_image

Use dd with care! Consult the man page for more info.

This copied the contents of the usb key block-by-block to a file called “disk_image”. The was a 2G image (the total capacity) of the wonky drive.

We then used photorec to try to recover any files from the image.


$photorec ./disk_image

Et voila! PhotoRec worked its magic and we recovered the thesis, along with all the other files.

Tags: , , , , , , , , ,

No comments yet.

Leave a Reply