1

When I need to do echo 3 > /proc/sys/vm/drop_caches with a sync beforehand, is it better to use

sync && echo 3 > /proc/sys/vm/drop_caches or

sync ; echo 3 > /proc/sys/vm/drop_caches.

Does it even matter because both commands are safe for the filesystem data? Or might the second version lose data in the process?

0

More like... you shouldn't need to do this at all. What's the root or underlying performance problem you're trying to correct with the drop_caches routine?

For the record, sync ; echo 3 > /proc/sys/vm/drop_caches is fine.

  • I wuld argue that the sync is superfluous as when dropping the cache the system will need to sync the contents to disk anyway. You don't lose data whatever you do. – wurtel Dec 14 '15 at 13:09
  • I stumbled upon this gem while migrating and old system to a VM. There are some long running processes that seem to leak memory over time. – micxer Dec 16 '15 at 8:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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