38 ms·
> Even if it were corrupting the FILES being written when hard booted, it shouldn't corrupt the FILESYSTEM being written. That's not how SD cards work unfortun
by tdicola 12y ago
> Even if it were corrupting the FILES being written when hard booted, it shouldn't corrupt the FILESYSTEM being written.
That's not how SD cards work unfortunately. When an SD card erases data, like if it's updating a file allocation table, it has to erase an entire block of flash and not just the bytes you care about. The card will throw the block into a cache in memory, erase the block, and then rewrite the parts of the block that weren't erased. However if you pull out power during that operation you'll completely kill the block and destroy the filesystem.
There's a great video here from Linuxconf Auckland about using SD cards for embedded systems and these issues: https://www.youtube.com/watch?v=K3zb6p0thQU https://www.youtube.com/watch?v=K3zb6p0thQU
- mark-r 12y agoI wish we had a filesystem that was tuned to the peculiarities of flash memory. It should be aware of the large erase blocks and optimize for that.
- zurn 12y agoThere's no inherent reason SD cards have to be like this, more sophisticated SSDs are designed to stay readable after power loss. But most SD cards are cheap and nasty so they don't.
- chisleu 12y agoI get that, but I don't get how that applies to the corruption we are seeing. We aren't having power fail issues.