sudo dd if=/dev/zero of=/swapfile bs=1k count=1024000
sudo mkswap /swapfile
sudo swapon /swapfile
在/etc/fstab中增加如下语句:
/swapfile swap swap defaults 0 0
检查效果:
#cat /proc/swaps
Filename Type Size Used Priority
/dev/sda4 partition 1357484 0 -1
/swapfile file 1024000 0 -2