Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

share|improve this question
add comment

2 Answers

up vote 2 down vote accepted

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.

share|improve this answer
    
ok, thank you ! –  NSchubhan Aug 23 '12 at 12:15
add comment

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.

share|improve this answer
    
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
add comment

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.