2

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.

DiverseAndRemote.com
  • 2,091
  • 3
  • 16
  • 16

2 Answers2

4

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.

EEAA
  • 109,363
  • 18
  • 175
  • 245
0
echo 3 | sudo tee /proc/sys/vm/drop_caches
Dennis Kaarsemaker
  • 19,277
  • 2
  • 44
  • 70