Clearing the disk cache

To clear the disk cache on a linux system you have to issue the following comnad:

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

If you are already root, then issue it without the sudo command:

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

The number 3 can be changed with  one from the following table:

1 free pagecache
2 free dentries and inodes
3 free pagecache, dentries and inodes

Leave a Reply

Your email address will not be published. Required fields are marked *