Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

My spouse's USB thumb-drive (WinXP filesystem, pretty sure...) was not "Safely Remove"d from my daughter's MacBook. Now (many) files and (all) sub-folders on it are corrupted (...yeah, I know...). Is it possible to recover [ some | most | all ] of these files and folders?

I've been trying to help her by mounting the thumb-drive on my Ubuntu 12.10 laptop. The thumb-drive mounts under Ubuntu (12.10), and does list files at the top level (have not tried to access those top-level files, though), but indicates that it "can't access /media/robert/CA71-F795/'folder-name': Input/output error" for every folder at that level (..face-palm...).

Not a noob, so though I strenuously try to avoid making this kinda mistake myself, I am unfamiliar with recovery practices/procedures as a result. Can anything be done to recover these files and folders? What would you do?

Thanks for any/all [ help | advice | suggestions ].

share|improve this question
add comment

2 Answers

USB sticks are usually FAT filesystem, I'm not sure what tools there are that might repair FAT filesystem, but you might find that you can read most/all of the files just from Ubuntu (ignoring the I/O errors) then recreate the filesystem to copy them back.

Quite often my partner brings Windows laptops home belonging to people she works with where the filesystems are knackered and Windows won't boot. Usually I can just boot a Ubunu live CD on them and even though you get lots of I/O errors at least Ubuntu will make a "best effort" to read the files where Windows seems less inclined to... so far I've always been able to recover the important stuff (photos, music, work documents etc.) for people.

So long as you don't try to write to the filesystem (you could even mount it read-only to be sure) it won't cause any further damage to just try to copy the files you need off there.

share|improve this answer
add comment

First, you should probably disable automount temporarily on your system. Start the program dconf-editor and navigate to org -> gnome -> desktop -> media handling and disable automount.

To help with the recovery you can make a bit copy of the thumbdrive (doesn't need to be mounted to do this)

dd if=/dev/sdx of=~/usbdrive.img

where sdx is the device in question. You can then mount the image of the pendrive as read only on /mnt:

mount -t vfat -o loop,ro,noexec ~/usbdrive.img /mnt

If you get errors but you are sure the file system is DOS (vfat) then you might need to repair the partition table before you can proceed. Hopefully it's not that bad though. You can now safely explore recovery options without even having the pendrive attached to the computer.

Some programs you might want to look at are photorec and testdisk. I can't give you much information on how to proceed with these because like you, I try not to put myself in this position, but I know from playing with them that they will try to identify valid partitions and the files on them, even if they have been deleted or scrambled.

Don't forget to set automount back to your preference after you have performed the copy.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.