Sunday, April 6, 2014

Flush Linux Buffer Cache

Cache is used to keep data to use frequently by operating system,  But sometimes memory is getting low linux provide some memory Command line to monitor Memory status Check the below link :-

1- Linux Check Memory Usage Here.
2- 18 Command Line Tools to Monitor Linux Performance here.

There are options available to flush cache of linux memeory :-


Flush everything ( Pagecache, dentries and inodes )  :-
 sync; echo 3 > /proc/sys/vm/drop_caches.
Flash dentries and inodes :-

 sync; echo 2 > /proc/sys/vm/drop_caches
Flash PageCache only

sync; echo 1 > /proc/sys/vm/drop_caches

All the command should be Run As root.

Schudle the above command as job using crontab , choose from the above command what you need :-

0  *  *  *  *  /root/memory.sh

Memorysh --> should be contain one the above script run as root.

Thank you
Osama mustafa
 

No comments:

Post a Comment