一、创建SWAP分区
1、创建 2G 的 Swap 文件
# dd if=/dev/zero of=/etc/swapfile bs=1024 count=2048000
2、制作为 Swap 文件
# mkswap /etc/swapfile
3、令 Swap 文件生效
# swapon /etc/swapfile
4、查看当前SWAP
# swapon -s
5、自动挂载
编辑/etc/fstab,将以下行追加到文件末尾:/etc/swapfile swap swap defaults 0 0
# vi /etc/fstab
/etc/swapfile swap swap defaults 0 0
6、查看创建好的 SWAP,已经增长了 8G
# free -h

二、删除SWAP分区
1、查看Swap文件
# swapon -s
2、关闭Swap文件
# swapoff /etc/swapfile
3、rm命令删除刚才Swap盘
# rm -rf /etc/swapfile
4、检查swap是否被删除
# swapon -s
# free -h

3061

被折叠的 条评论
为什么被折叠?



