Someone (Hsuan, to be precise, but that isn't the point really) came to me recently with a corrupted SD card. Normally, I don't do corrupted SD cards. I so do not want to be that guy that sits there and fixes what is broke. That doesn't appeal to me at all. But when there is a command line involved, or a real mystery ... I can find it hard to resist. You can see why my career as something other than a widget twiddler is not really taking off.
The answer, if you like to skip the narrative (hmph) is photorec. Which actually does amazing things for all manner of data recovery.
Here's what I had before me:
[0 amanda@stillwell CANON_DC]$ find . -type f
find: Filesystem loop detected; `./DCIM/101CANON/101CANON' has the same device number and inode as a directory which is 1 level higher in the filesystem hierarchy.
So whatever, PhotoRec. Great. But people always want to know why. I do. So why? Why? David Henry, who I do not know, and yet kind of do know (the internet is sneaky that way) had a pretty good explanation, which I can't really improve on:
I was long puzzled by filesystem stuff, until I realized much is done by elves!
View Filesystem Loop Detected