创建
dd if=/dev/zero of=/var/swapfile bs=1M count=2048
mkswap /var/swapfile
swapon /var/swapfile
chmod -R 0600 /var/swapfile
echo "/var/swapfile swap swap defaults 0 0" >> /etc/fstab
删除
swapoff /var/swapfile
rm -rf /var/swapfile
vi /etc/fstab
#删除 /var/swapfile swap swap defaults 0 0