/etc/fstab 禁用swap无效 /etc/fstab 注释掉swap,重启后,free -m 又看到swap。 这是其它服务启用了swap,并且貌似还禁用不了,所以选择在开机脚本中关闭。 vim /etc/rc.local 输入如下内容: #!/bin/bash sudo swapoff -a 赋予执行权限 chmod a+x /etc/rc.local 设置开机启动 systemctl enable rc.local systemctl restart rc.local