I have a ubifs device (EdgerouterX) and a daemon that edits a configuration file on first startup. I kept noticing that this file, as well as other files I edited on the Edgerouter would become corrupt on a power failure and reboot.
Files that where edited get filled with this
@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^
No new lines, and in proportion to the length of the original file.
If I manually run 'sync' at any time then there's no corruption no matter how hard I try (without further editing I mean). But even waiting 10+ minutes the system itself does not run sync. Where can I edit the write back timeout?
This seems to be evident on devices with ubifs and kernel 4.14.x. I have seen it also on powerpc-based devices, meraki mr24. In my case, I am seeing the files from /rom/etc/config/ that don't change, but are copied to /overlay/upper/etc/config/ corrupted. I am currently chasing this on the #linux-mtd irc channel on irc.oftc.net