logo-fox

说明:阿里服务器安装系统之后,默认swap为0 。该篇是阿里服务器上配置swap 的过程记录:

1.进入目录

  cd /var/

2.获取要增加的SWAP文件块(这里以1GB为例,count = 1024 x 1024=1048576)

  dd if=/dev/zero of=swapfile bs=1024 count=1048576
3.创建SWAP文件

  /sbin/mkswap swapfile

4.激活SWAP文件

  /sbin/swapon swapfile            (此时便可通过free命令看到有swap空间了)

5.查看SWAP信息是否正确

  /sbin/swapon –s

6.添加到fstab文件中让系统引导时自动启动

  echo "/var/swapfile swap swap defaults 0 0" >>/etc/fstab

7.修改/etc/rc.local

  cat /etc/rc.local
  touch /var/lock/subsys/local

8.重启服务器

  reboot

分类:

技术点:

相关文章:

  • 2021-12-04
  • 2021-11-28
  • 2021-11-22
  • 2021-11-20
  • 2021-11-14
  • 2021-09-08
猜你喜欢
  • 2022-12-23
  • 2021-12-14
相关资源
相似解决方案