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.

I have tried

sudo sh -c 'echo 3 > /proc/sys/vm/drop_caches'

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

echo 3 > /proc/sys/vm/drop_caches

echo 3 | sudo tee /proc/sys/vm/drop_caches

and a bunch of other variations but with every try I get

bash: /proc/sys/vm/drop_caches: Permission denied

How do I clear the ram used for buffers/cache in my centos6 openvz container?

It seems like the only way to do what I need is to reboot the container.

share|improve this question
1  
Why would you want to? –  David Schwartz Dec 3 '12 at 2:45
add comment

2 Answers

up vote 2 down vote accepted

Get a real non-OpenVZ machine (KVM, Xen, etc) and this will work just fine. With OpenVZ, you don't get your own kernel instance and as such, are restricted from performing commands like this.

share|improve this answer
add comment
echo 3 | sudo tee /proc/sys/vm/drop_caches
share|improve this answer
    
That was one of the things I also tried and it doesn't work –  Omar Jackman Dec 3 '12 at 0:14
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.