设置步骤
su root
cd /etc
swapoff /etc/swapfile
dd if=/dev/zero of=/etc/swapfile bs=1M count=2048
mkswap /etc/swapfile
swapon /etc/swapfile
最后,修改/etc/fstab,添加一行
/etc/swapfile none swap sw 0 0
如果要删除交换分区和交换文件,逆着上面的顺序操作:
先删除/etc/fstab文件中添加的交换文件行
停用交换文件swapoff /etc/swapfile
删除交换文件rm -fr /etc/swapfile