Use ‘sync’ Tool to Commit Changes in Embedded Linux

When you’re working in an embedded Linux environment, liberal use of the sync command can be a headache saver. Here’s the thing: in most embedded systems, your OS will be running from something like an SD card or flash and you may be subject to unexpected power loss. When you’re editing files or making changes in the filesystem, some of these edits and/or changes are only written to buffer cache, not the flash disk (not yet anyways). sync will force the system to commit the buffer cache to the disk.

As always, be sure to check out the man page for more information.

Feel free to donate if this post prevented any headaches! Another way to show your appreciation is to take a gander at these relative ads that you may be interested in:

There's 0 Comment So Far

Share your thoughts, leave a comment!