3 ms·
My limited understanding from reading articles on the topic is that the SD card is doing things like wear leveling in a way that the OS can't control, so if it
by jrockway 7y ago
My limited understanding from reading articles on the topic is that the SD card is doing things like wear leveling in a way that the OS can't control, so if it loses power while it's doing that, your data is gone. It's like a separate computer, and the integrity of your data requires running the program to completion.
It seems like a bad model if you ask me, but performance is what reviewers publish, not reliability under failing power, so this is what we get. It is obviously possible to fully journal these internal operations and recover them when power is next available (resulting in FS-level errors, instead of internal errors). But the cards do not do this.
With eMMC, you just have the raw flash cells available directly, so you can write this code. With SD, you don't have enough control to write correct code, so you are stuck with what the vendor gives you.
- derefr 7y agoWhy does this same problem never occur with USB flash drives? Is it just that a USB device is usually large enough to have room for some power capacitors?
- Dylan16807 7y agoUSB is also designed so that data disconnects before power. I'm not sure if that's enough by itself.
- solarkraft 7y agoNot if the device loses power, right? I'm guessing USB flash drives will have the same internal mechanisms as SD cards and thus suffer from the same problems.
- Dylan16807 7y agoOh, are you talking about flash drives used as system drives on a Pi? Because in desktop use power rarely goes out and even more rarely has anything been written recently. In the Pi use case I have no idea.
- solarkraft 7y agoI have had 2 USB flash drives fail, one definitely after being unexpectedly disconnected (about the other one I don't know).