I have OpenVZ VPS and have problem with clearing the cache:
In OpenVZ not work echo 3 > /proc/sys/vm/drop_caches
How may be this cache clear?
This was reported on the OpenVZ bug tracker. It has been resolved as RESOLVED WONTFIX
From Kir Kolyshkin in the bug report (project leader of OpenVZ):
All containers share the same page cache (although there is per-container accounting), so to drop caches of one single container we have to check each page:
1 Whether it belongs to the container or not -- supposing we do have that information, which I am not sure of
2 Whether this page is used by other containers.
So, while this is trivial on the host system, it is much less trivial for a container. And this is not a critical piece of functionality -- drop_caches is only useful for running various sorts of benchmarks.
Since your don't get your own kernel instance with OpenVZ you are prevented from running the command.
OpenVZ don't support to clear cash.
Could you try doing below steps -
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
If these steps doesn't work -
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.