The Importance of Sync in Embedded

1 My experience

I modified /etc/init.d/rcS in development board, but after I restart the board, the modification disappear !!

2 Solution

Before reboot, use

# sync

especially for newly modified config files, e.g. rcS

3 Sync Info

Check the sync manual:

$ info coreutils 'sync'
14.4 `sync': Synchronize data on disk with memory

`sync' writes any data buffered in memory out to disk.  This can
include (but is not limited to) modified superblocks, modified inodes,
and delayed reads and writes.  This must be implemented by the kernel;
The `sync' program does nothing but exercise the `sync' system call.

   The kernel keeps data in memory to avoid doing (relatively slow) disk
reads and writes.  This improves performance, but if the computer
crashes, data may be lost or the file system corrupted as a result.
The `sync' command ensures everything in memory is written to disk.

   Any arguments are ignored, except for a lone `--help' or `--version'
(*note Common options::).

   An exit status of zero indicates success, and a nonzero value
indicates failure.