Jump to content

Recommended Posts

Posted

Hi all,

I have a strange problem, when I make any file system changes, I can count to 10, pull out the power, and my changes are lost.

My application sometimes requires changing of a settings file, and then quickish disconnection of power by the user (I know its not good, but it's a fact of the product)

My current solution is to flush the write cache when I save the settings, I forget the command name, but that isn't ideal as other changes such as logging is lost.

I'm using the armbian debian release at the moment.

How can I change this write-cache timing to something like 2 seconds?

Also, is this an SD-card technology issue or will the issue disappear for eMMC?

 

Thanks

 

 

Posted

It is filesystem mount property. Edit /etc/fstab and change from commit=600 to commit=2 ... some performance and flash media lifespan will be lost.

Posted
19 minutes ago, ChrisAdmin said:

My current solution is to flush the write cache when I save the settings, I forget the command name, but that isn't ideal as other changes such as logging is lost.

 

Leave everything as is and simply use this command:

/usr/sbin/log2ram write ; sync &

This will write changes to SD card while still lowering write amplification a lot (high 'write amplification' is the reason why SD cards and other flash media die too early)

Posted
38 minutes ago, ChrisAdmin said:

My application sometimes requires changing of a settings file, and then quickish disconnection of power by the user (I know its not good, but it's a fact of the product)

 

Just for the record: your above procedure is a great recipe to get a corrupted rootfs so you shouldn't be too surprised if the filesystem gets corrupted and the board fails to boot the next time. There are solutions for this problem (do a search for 'read-only rootfs' for example).

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines