free -h # 查看交换分区
sudo fallocate -l 8G /swapfile
提示:fallocate失败,文本文件忙,需先关闭交换分区
sudo swapoff /swapfile
再依次执行以下命令:
sudo fallocate -l 8G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
标签:ubuntu20.04,swapfile,分区,sudo,交换,fallocate From: https://www.cnblogs.com/jimchen1218/p/17819663.html