Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My company sells an "embedded device" which is implemented as a headless Linux box with ext4 on an internal SSD. Some of our users have a habit of doing a "save current settings" on this box, and then cutting power to the unit as soon as the unit reports that the save completed (ie two seconds later). This was causing occasional corruption of the saved files, as the data wouldn't always get flushed to the SSD before the power went out. So I tweaked my software to run /bin/sync immediately after writing the file (after closing the file handle but before notifying the user that the save completed). This appears to fix the issue, but my coworker says that one call to /bin/sync isn't sufficient, and that to be really safe I ought to run /bin/sync twice in a row.

That sounds like paranoia to me... Perhaps a habit from earlier versions of Linux or unix whose sync utility didn't work reliably. Does his advice have merit, or should one call to /bin/sync suffice?

share|improve this question
up vote 7 down vote accepted

This link sums it up pretty well -- One call to sync should suffice. Doing it more than once is definitely a holdover (and one I stick to myself), but if you're doing it programmatically you aren't gaining anything - it's the delay it takes you to type out those 5 keystrokes that you were really going for.

Of course the real answer is to officially discourage yanking the power, and instead provide a shutdown feature that users are told to use, but you'll always have to deal with plug-yankers...

share|improve this answer
+1 for giving the user a way to gracefully shutting down the system within the UI. – mrdenny Jan 5 '11 at 23:10

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.