扩大swap大小

Posted on Mar 20, 2021

扩大swap大小

代码如下:

swapon -s
free -m
sudo swapoff /swapfile
swapon -s
free -m
fallocate -l 8G /swap
sudo fallocate -l 8G /swap
du -sh /swap
chown root:root /swap
sudo chown root:root /swap
sudo chmod 600 /swap
mkswap -L swap /swap
sudo mkswap -L swap /swap
swapon /swap
sudo swapon /swap
free -h
sudo micro /etc/fstab
free -m