Linux开启swap的方法

free -m
cd /var/
dd if=/dev/zero of=swapfile bs=1024 count=1048576
mkswap swapfile
swapon swapfile
echo '/var/swapfile swap swap defaults 0 0' >> /etc/fstab
cat /etc/fstab
free -m