4

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?)

1 Answer 1

4

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .