You can’t prevent Linux from using the file cache and you don’t want to. However, on occasion you may want to flush it. Here’s how:
First, flush your filesystems to disk. Just run the command sync
Then, echo 1, 2 or 3 in to /proc/sys/vm/drop_caches. It breaks down like this:
- free pagecache:
echo 1 > /proc/sys/vm/drop_caches
- free dentries and inodes:
echo 2 > /proc/sys/vm/drop_caches
- free pagecache, dentries and inodes:
echo 3 > /proc/sys/vm/drop_caches
Did you find this post useful or have questions or comments? Please let me know!