centOS7 关闭swap

时间:2023-03-10 08:46:48
centOS7 关闭swap
[root@cdh- sbin]# free -g
total used free shared buff/cache available
Mem:
Swap:
[root@cdh- sbin]# cat /proc/vmstat | egrep "dirty|writeback"
nr_dirty
nr_writeback
nr_writeback_temp
nr_dirty_threshold
nr_dirty_background_threshold
[root@cdh- sbin]# sysctl -w vm.swappiness=
vm.swappiness =
[root@cdh- sbin]# echo "vm.swappiness = 0">> /etc/sysctl.conf
[root@cdh- sbin]# swapoff -a
[root@cdh- sbin]# free -g
total used free shared buff/cache available
Mem:
Swap:
[root@cdh- sbin]# sysctl -p
vm.swappiness =
vm.swappiness =
[root@cdh- sbin]# free -g
total used free shared buff/cache available
Mem:
Swap:

第一部分Mem行解释:
       total:           内存总数;   

used:          已经使用的内存数;

free:           空闲的内存数;

Buffers/cached:        磁盘缓存的大小。

关系:  total = used + free +Buffers/cached