今天在vps上装了个msf,装了一半竟然被kill掉了,因为RAM只有512M,swap也只有130M。遂到网上寻求解决办法,下面是我的笔记:

查看当前swap大小:

free -h

修改swap大小:

思路是先删除swap分区,再重新配置一个更大的swap:
```
    删除swap分区
    swapoff -a

    创建swap分区文件:
    dd if=/dev/zero of=/root/swapfile bs=1M count=1024
    #1M*1024 = 1G, 故swap为1G

    格式化分区文件:
    mkswap /root/swapfile

    启用swap分区文件:
    swapon /root/swapfile

    设置开机启动
    修改 /etc/fstab, 添加或者修改此行
    /root/swapfile swap swap defaults 0 0
    
```

参考文章:http://www.bandwagonhost.net/1170.html

相关文章:

  • 2021-08-18
  • 2022-12-23
  • 2022-12-23
  • 2021-04-19
  • 2021-05-20
  • 2022-12-23
猜你喜欢
  • 2021-09-20
  • 2021-06-03
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-06
  • 2022-02-13
相关资源
相似解决方案