Think before you speak, read before you think.

关闭 swap 操作

检查:

free -m # 应该 Swap 显示全是 0

备份 /etc/fstab

cp /etc/fstab /tmp/fstab.`date +%F`

删除 /etc/fstab 中 swap 挂载项

vim /etc/fstab

关闭所有 swap

swapoff -a

观察进程使用 swap 和 swapoff -a 之后回收情况,对于不能回收 swap 的进程需要安排时间重启


free -m
for file in /proc/*/status ; do cat $file | awk '/Name|^Pid|VmSwap/{printf $2 " " $3 $4}END{ print ""}' | grep kB | grep -v '0 kB' ; done | sort -k 3 -n

Comments

Leave a Reply

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