Filesystem for SD cards
i am a user of micro sd cards(2-4GB ) with ext3/2 filesystems for embedded real time products that are prone to power cycles.
Recently i have seen SD card corruptions after power cycles quite frequently. The card gets errors in some blocks which renders those blocks unreadable. On verifying the status of the card, it has an error bit set that is defined as "undefined error" ..
Now my questions are:
Is ext2/ ext3 filesystems suitable for micro sd cards.?
If not what are the other filesystem options?
Any time there is a power failure, a drive (including SD cards) can get corrupted. If you run fsck on the file system, it should be recoverable, and with ext3 logging you will lose less data. However, with SD cards, the sectors so corrupted may be, as you have found, no longer available for use. I don't know if you are influential in the design of the hardware, but I would recommend some kind of battery or capacitor backup power, even if it only provides power for the few seconds required to sync the file systems first and force them to be unmounted, so that the power failure is handled a bit more rationally and things don't get totally scrambled.
Thanks for ur sugstion rubberman..
We have kept the hardware option as the last resort.. Actually i was pondering if ext3/ext2 has some inherent limitaions to deal with sd cards that can be subjected to power cycles...
Are there any other better filesystems for sd cards?
I doubt it has anything to do with the file system, but more a matter of power surges and fluxuations that occur under power-fail conditions. I use ext2/ext3 file systems on micro sd cards all the time, and generally they are just fine, although they aren't suitable for frequent write cycles - using them for cache/swap space is death to them, pdq.
FWIW, if you need a small form-factor device for embedded products that will recover better from power glitches and you can accept the size and cost of a compact flash device, then a CF micro drive (up to about 5GB available - 4GB ~= $60USD) might be better for you. Pretty much unlimited write cycles, better write speeds generally, and more recoverable from power failures and spikes. A journaling file system such as ext3 would be able to recover pretty well, plus you can use syncronous writes if you need to guarantee that data is written immediately to disc, and not cached unwritten. Using syncronous writes to a solid state flash drive will result in very short lifespans of the device, and normal Linux caching will cause serious data loss on power failures. The alternative, as far as I can see, is a battery backup, which will add to the cost as well as have about the same sort of footprint as a CF adapter and drive.
Thanks a lot for ut helpful suggestions.. we have products with cf cards also where we have not seen this issues.. we shifted to usd only bcoz of lesser size and price..
We are plannig to use cap that can support volt upto 1s .this shld pretty much save us...
Part of the problem with micro sd cards is that most are consumer grade. You need to get certified commercial or military grade chips in order to avoid a lot of this sort of stuff. CF cards typically have better quality control (and higher prices) than sd cards since they are used for more this sort of application. Sure, usd cards are cheap, as little as $2 USD per GB, whereas CF cards are $6-10 per GB, but to quote that hoary old saw, "You get what you pay for". A higher grade usd or sd card is going to cost at least double what the cheap commercial cards do, which gets them up to the same price range as a CF card, although that doesn't mitigate the cheaper connectors and smaller form factor they boast.
Here's a link that might be of interest: Slashdot Hardware Story | "Limited Edition" SSD Has Fastest Storage Speed. It also has an embedded capacitor to help deal with power-failure situations and is designed to minimize error conditions.