Flushing the disk cache

Posted on Thursday, 17th January, 2008 in Life

I’ve been looking for this over and over and over, until I had some inspiration today (thanks to Andew and Chris) .. this has one and only one sole purpose: safekeeping, so I don’t end up searching for it all over again …

To free pagecache:

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

To free dentries and inodes:

# sync; echo 2 > /proc/sys/vm/drop_caches

To free pagecache, dentries and inodes:

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

Once that is done, you’ll see the memory (usually RAM) freeing up.


One Response to “Flushing the disk cache”


  1. Any idea how this is done on pre 2.6.16 kernels? The feature was added on 2.6.16.

Leave a Reply