1

添加swap分区

 1 year ago
source link: https://zhangyiming748.github.io/2022/09/01/NewSwap/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

0x01 检查是否有Swap空间

`free -h`

0x02 创建swap分区

创建2G的swap,可以根据你的服务器配置来调整大小,一般情况下,Swap空间不需要很大

$ sudo dd if=/dev/zero of=/mnt/swap bs=1M count=2048  

0x03 设置交换分区文件

$ sudo mkswap /mnt/swap

0x04 启动swap

$ sudo swapon /mnt/swap

0x05 设置开机启用 swap 分区

$ sudo vim /etc/fstab
#
/mnt/swap swap swap defaults 0 0
#

0x06 检查是否有Swap空间

`free -h`


0 comments

Be the first person to leave a comment!


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK