Sdcard lost in case of power default

Started by flavigny, November 19, 2012, 12:01:50 pm

Previous topic - Next topic

flavigny

Hello,
I am experimenting about autonomy of O'Maxi (full powered by Li-Ion on jack plug, see another post).
Of course, running until power down, terminates without exit, sync and so on.
I observe frequently that the SdCard is killed (boot error 0x8020a012 or a014).
I note that mounting back the sdCard in my Ubuntu workstation, partition 2 appears clean. I will investigate if partition 1 is altered.

For my design, I wish that O'maxi starts again when next powered On.

Is it a way to secure that? I dream of something like a "read-only" boot disk.
Other way: when running only a dedicated process, is it possible to umount sdcard and continue running?

Regards
PO.

ecolomato

I remember have read on datasheet that IMX233 have voltage level monitor. Maybe you can monitor battery voltage by code and shutdown before the disaster occurs.

ecolomato

Or you could monitor the voltage level with a voltage divider (resistors) connected to an adc input of the IMX233, if there is no voltage level monitor.

cnoviello

Different mount point with read-only filesystems is a good solution to ensure no data lost and sd-card corruption. For example, you can use this partition schema:

/dev/sdx1     /      ro
/dev/sdx2     /var rw
/dev/sdx3     /data rw

EXT3 or EXT4 filesystem type is the best option. Moreover, add a script into runlevels that do fs check of sdx2 and sdx3 before mount them. I can guarantee you that it's not difficult to arrange your filesytsem in this way. At the end, take account of use a transactional database like Sqlite to store your application data.
We use this technique successfully on tens of ARM board we have (we recently introduced Olinuxino too) and we never had problems related to power fault.

Cure

I'm wondering if this Read-Only partition would work under Debian and on my A13?  Is anyone using this now, or can anyone explain how this can be done?

Would it work if I ran a script after bootup and changed the partition to Read-Only?  Or is there an easier way?

Thanks,
Rob