How to disable the host swap partition
Solution
-
Run the following command on the host to view swap partition details and memory/disk usage:
[root@localhost ~]# free -m -
Migrate all virtual machines on the host to other hosts using the virtualization platform to ensure no data is being written to the swap partition.
-
Run the following command to disable the swap partition:
[root@localhost ~]# swapoff -a -
Comment out the swap partition mount entry in the
/etc/fstabfile. -
Edit the
/etc/sysctl.confconfiguration file and add vm.swappiness=0. -
Run the following command to make the configuration permanent:
[root@localhost ~]# sysctl -p