Ubuntu Server Swap partition settings

Option One: they only apply in the case of swap partition memory exhaustion

# 首先进入 sudo 模式
sysctl vm.swappiness=0  # 临时生效
echo "vm.swappiness = 0" >> /etc/sysctl.conf  # 永久生效

Option Two: to completely disable swap partition

If your memory is absolutely enough, you can completely disable the swap swap partition to avoid possible impact.

  1. sudo swapoff -a: The temporary closure of the swap partition
  2. Modify /etc/fstab, comment out the line with a swap words (Comments start with #).
  3. sudo rm -rf /swap: Completely deleted the swap partition

Guess you like

Origin www.cnblogs.com/kirito-c/p/12058159.html