Best file system for removable media

data-recoveryfilesystemssd card

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?

Best Answer

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.

Related Question