阿里云Centos7开启swap虚拟内存

  1. mkdir /swaps
  2. cd /swaps
    dd if=/dev/zero of=swaps bs=512k count=4096   ##swap大小为bs*count=4096*512/1024/1024=(2G)
  3. mkswap swaps
  4. swapon /swaps/swaps
  5. 开机挂载
    vi /etc/fstab
    #文件追加一行
    /swaps/swaps swap swap defaults 0 0

转自:https://www.cnblogs.com/huzhi/p/10838257.html