0

if i play those command :

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

Will the server be force to read the correct file on disk until i put 0 again ?

Or this work only one time, and if i want to clear cache again, i've to put 0 and 3 again ?

Thanks

NicoMinsk
  • 125
  • 8

2 Answers2

2

No - that just drops the existing caches. As soon as you start reading files, linux will start caching them again.

There shouldn't be a scenario in which linux reads "old" data from a disk cache though, if that's what you are worried about.

Tom Newton
  • 4,141
  • 2
  • 24
  • 28
0

You don't need that kind of wizardy. Linux will cache files it reads, but a write operation invalidates the cache entry for that file and it will be read again from disk during next read access.

Janne Pikkarainen
  • 31,852
  • 4
  • 58
  • 81
  • indeed, I am concerned about the Op's motive. I can see why you might want to do this (eg. performance testing assuming cold cache)... but these are few and far between – Tom Newton Aug 23 '12 at 12:35