zeldor.biz

Linux, programming and more

Copyright © 2025
Log in

Linux Caches

March 14, 2013 by Igor Drobot Leave a Comment

Cache

Writing to on of this three files will cause the kernel to drop clean caches, dentries and inodes from memory, causing that memory to become free.

To free pagecache:

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

echo 1 > /proc/sys/vm/drop_caches

To free dentries and inodes:

1
echo 2 > /proc/sys/vm/drop_caches

echo 2 > /proc/sys/vm/drop_caches

To free pagecache, dentries and inodes:

1
sync && echo 3 > /proc/sys/vm/drop_caches

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

As this is a non-destructive operation, and dirty objects are not freeable, you should run every time “sync” before you start to drop something.

1
sync && echo 3 > /proc/sys/vm/drop_caches

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

Swappiness

Control swappiness behavior:

1
cat /proc/sys/vm/swappiness

cat /proc/sys/vm/swappiness

1
echo 100 > /proc/sys/vm/swappiness

echo 100 > /proc/sys/vm/swappiness

Filed Under: Linux Tagged With: Cache, Kernel, Memory, swappiness

Categories

Archives

Tags

apache2 Apple arduino ARM Automation backup bash Cisco Cluster Corosync Database Debian Debian squeeze DIY DNS Fedora FTP Fun Icinga Ipv6 KVM Linux LVM MAC OS X Monitoring MySQL Nagios Nginx openSUSE OpenVPN PHP Proxy Python python3 qemu RAID rsync Samba security ssh Ubuntu virtualization Windows Windows 7 Wordpress

Leave a Reply

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

Yeaaah Cookie! We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.Ok