Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a paranoid decades-old habit of frequently typing 'sync' at a command line on my Linux (or any unixy) machine. Some part of my mind thinks this will make sure files are written to disk not just taking a nap in some buffer in RAM. This was important in the 1980s.

Is this relevant any more? Does it matter at all? Surely it does no harm (besides kids calling me 'gramps') but does it do any good?

(Side question - are there new paranoid habits a Linux user should form concerning file saving safety?)

share|improve this question

1 Answer 1

up vote 3 down vote accepted

I have a paranoid decades-old habit of frequently typing 'sync' at a command line on my Linux (or any unixy) machine.

This smells like you feel like you have an unstable machine, remedy the cause and not the sympton.

When you do run sync, it should be sufficient to run it only after you do important things.

Some part of my mind thinks this will make sure files are written to disk not just taking a nap in some buffer in RAM. This was important in the 1980s.

Not just a thought, this is still what happens to this very day.

Is this relevant any more? Does it matter at all? Surely it does no harm (besides kids calling me 'gramps') but does it do any good?

Yes, definitely; go copy a huge file from one disk to another using a bare cp command, after it returns to prompt immediately pull the plug and after a reboot md5sum both files; they'll differ.

For smaller files, the chance they aren't written to disk is a lot smaller; but it can still happen that the power drops out at an unfortunate moment, there's not much you can do about that. And disabling buffers just for this purpose would be a very bad idea.

(Side question - are there new paranoid habits a Linux user should form concerning file saving safety?)

No, basically the typical ones:

  1. Use a stable kernel, file system, and so on; no experimental stuff which may contain bugs.

  2. Save early, save often. Accompanied with sync.

  3. Take back-ups.

  4. Avoid running out of disk space.

  5. Make sure your hard drive isn't failing soon.

share|improve this answer

Your Answer

 
discard

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.