Skip to content
create swap
2025年11月11日 root

查看 ​

shell
swapon --show

没有任何结果的话,就是没有启用swap

创建 ​

shell
fallocate -l 8G /swapfile
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile
swapon -a

8G 可以换成自己想要的大小

开机启动 ​

shell
echo '/swapfile  none  swap  sw  0  0' >> /etc/fstab

确认是否成功 ​

shell
swapon --show

Last updated: