Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Recently I had a SD card destroyed ( software wise ) on me. Basically as well as I can figure it out, all the metadata was wiped (ext4 card). This happened when I was working and suddenly had to write a check. I yanked the card I was working on, put in my "accounting card" wrote the checks, scanned them. pulled the "accounting card" put in the working card. As I start to work I see that my working card is labeled the same as my "accounting card". What I figure is that I forgot to unmount ( or thought I did, but it failed ) the "accounting card" replaced it, a random call to sync then overwrote my working card's metadata.

This was a minor annoyance, but it got me to thinking about recovering data. If all the data about which sectors constitute a file is in the metadata. and the metadata is wiped then the file is gone. But if the file contains references to the blocks it uses then that file is not lost. This might not be practical on a hard drive though.

For the most part the use cases on an SD card are much different from the use cases of a hard drive. Where on the hard drive you are often modifying files, on an SD card you tend to read files, write entire files and delete entire files. On occasion you modify files, but more rarely then you do on regular HDs. At least that is my usage.

Also corruption modes of HD's and SD cards are different. HD's are corrupted when you have some sort of system crash, or when you have some sort of abrupt power off. SD cards are corrupted when you fail to unmount. If the file stores all it's own sector information, then it is less important if the metadata gets flushed.

So is there a filesystem for SD cards where recovery is virtually gauranteed, and has reasonable overall performance?

share|improve this question
    
I wrote a whole article about it on my hate blag: polemon.posterous.com/fs-fuss-on-flash-drives –  polemon Apr 21 '12 at 5:02

3 Answers 3

To answer your specific question: "So is there a filesystem for SD cards where recovery is virtually gauranteed?"

NO!

It also appears that you are confusing the issue here. The problem that you describe having is with the way the system handles I/O for removable media, not with the filesystem itself. It is possible to recover corrupted information from any filesystem, but this assumes the information was previously there to recover. When I/O operations to a disk are disrupted, then the information is never written to the filesystem to begin with, and therefore there is nothing to recover.

To avoid these types of problems in the future, use the proper mount options for the media. In particular, use the 'sync' option when mounting, which will force all writes to be performed immediately, instead of being cached. By default, caching is enabled for all partitions, which allows for better performance, but can cause these types of problems because of the asynchronous nature of the I/O operations.

share|improve this answer

ZFS - Probably the best choice.

Assuming you're going to use a *nix system all the way. For instance, this will not be applicable on a Canon camera but will work on any Solaris, BSD and most Linux dists.

Quote:

One major feature that distinguishes ZFS from other file systems is that ZFS is designed from the ground up with a focus on data integrity. That is, protect the user's data on disk against silent data corruption caused by bit rot, current spikes, bugs in disk firmware, ghost writes, and so on.

share|improve this answer

Probe the recover command to recover the data and eventually you can use Testdisk to recover erased or corrupted partitions.

share|improve this answer
1  
The question is not about how to recover the files, but the best filesystem for SD cards. –  jasonwryan Sep 4 '12 at 5:58

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.