Using MMC/SD cards in a Linux system with unpredictable power losses

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Using MMC/SD cards in a Linux system with unpredictable power losses

836 Views
darron
Contributor I

How might we best configure a MX28 Linux-based platform so that we can write data to MMC/SD cards and not lose data in the event of a power loss? (or how to reduce that risk as much as possible)

I am open to formatting the data in any way necessary.  (Any filesystem, etc)

Our performance requirements are quite low (writes of ~100 bytes every couple of seconds).

I'm currently considering using JFFS2 via block2mtd...  is there any serious problem with this on MMC/SD?  Anything in the MMC/SD layer that invalidates all the protections it attempts? I would try to take care to match erase block sizes to a reasonable minimum that should always work (128KB)

Alternatively, we could keep VFAT and preallocate large files to write into.  However, we'd have to somehow enforce erase block alignment and remove metadata updates like "last modified time".  That is attractive in the sense that customers could stick the cards into their PCs to get data in a bind.

Or...  does anyone have experience with configuring this platform to do emergency disk syncs as the voltage drops below a threshold? MMC/SD might not be predictable enough and almost certainly isn't fast enough for that.

Our platform does not have any battery (just one for an external RTC).

Labels (1)
0 Kudos
3 Replies

668 Views
darron
Contributor I

Due to the SD card controller's wear leveling, I can't tell what may be erased. So, I'm just going to have to stick with one short set of write events per day and hope for the best. What a crappy standard.

0 Kudos

668 Views
darron
Contributor I

I've decided to stick with VFAT so clients can get data off easily. I plan on writing data to the MMC cards only once a day.  I'll keep data on UBIFS until a day is complete, then copy it to MMC. I even currently plan on copying all metadata on the MMC to UBIFS for the duration of the write so that I can recover if something fails. The only tricky part there is locating and backing up data on the erase page where the new files WILL be. Hopefully that's just the sector indicated by the first free FAT entry.

0 Kudos

668 Views
JamesAttewell
Contributor I

Hi Darron,

I have recently been looking at the same thing and doing a lot of research on it but I haven't got a definitive answer yet. From what I have found out it seems that EXT3 would be a good option as it adds the journalling option to EXT2, this still wont stop losing data if the power is lost at wrong point but it should avoid corruption better and make sure things are more consistent (I think).

It will be very interesting to find out what others think on this subject!

James

0 Kudos