[PVE-User] Disable SWAP on hosts with SSD

Thomas Lamprecht t.lamprecht at proxmox.com
Tue Jan 9 10:42:35 CET 2018


On 1/9/18 10:26 AM, Fabrizio Cuseo wrote:
> Hello.
> Can I safely disable swap on hosts with PVE installed on SSD drive ? I think that 8Gbyte of swap space on 144Gbyte hosts is not so useful and can accellerate wearout of SSD drives.

Yes you can. But maybe it's a bit saver to turn the vm.swappiness knob
down so that the swap gets only used in real out of memory situations.

>From the kernel docs [1]:

This control is used to define how aggressive the kernel will swap
memory pages.  Higher values will increase aggressiveness, lower values
decrease the amount of swap.  A value of 0 instructs the kernel not to
initiate swap until the amount of free and file-backed pages is less
than the high water mark in a zone.

The default value is 60."

This has the advantage that if your memory is exhausted, by whatever reason,
you may still have a functioning system.

To temporarily set it live use:
# sysctl -w vm.swappiness=0

To make it permanent (surviving reboot) create a file in /etc/sysctl.d/ with
".conf" as ending, e.g.:

# cat /etc/sysctl.d/swappiness.conf 
vm.swappiness = 0

But, if you can be sure that you have enough memory available you can also
turn it off entirely.


[1] https://www.kernel.org/doc/Documentation/sysctl/vm.txt

More information about the pve-user mailing list