ubuntu设置虚拟内存swap

cooolr 于 2022-03-18 发布

• 内存小于2gb 的系统——内存总量的2倍。

• 具有2至8gb 内存的系统——与内存大小相同。

• 内存超过8gb 的系统——至少4gb 的交换空间。

sudo fallocate -l 2G /swapfile
sudo chmod 600 /swapfile
	sudo mkswap /swapfile
sudo swapon /swapfile
# sudo nano /etc/fstab
/swapfile swap swap defaults 0 0