CentOS下清理swap和buffer/cache
时间:2014-02-24 15:52 来源:linux.it.net.cn 作者:IT网
swap清理:
-
swapoff -a && swapon -a
注意:这样清理有个前提条件,空闲的内存必须比已经使用的swap空间大
cache清理:
-
sync; sync; sync;&& echo3 >/proc/sys/vm/drop_caches
-
sleep 2
-
echo 0>/proc/sys/vm/drop_caches
To free pagecache:
-
echo 1>/proc/sys/vm/drop_caches
To free dentries and inodes:
-
echo 2>/proc/sys/vm/drop_caches
To free pagecache,dentries and inodes:
-
echo 3>/proc/sys/vm/drop_caches
/proc/sys/vm/drop_caches 的值默认为0(所以我们清空后,还再恢复它的值为0)
(责任编辑:IT)
swap清理:
cache清理:
To free pagecache:
To free dentries and inodes:
To free pagecache,dentries and inodes:
(责任编辑:IT) |