Jump to content

orange pi sdcard write-cache delay


ChrisAdmin

Recommended Posts

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

 

 

Link to comment
Share on other sites

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)

Link to comment
Share on other sites

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).

Link to comment
Share on other sites

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

Important Information

Terms of Use - Privacy Policy - Guidelines