Discussion:
[PVE-User] Disable SWAP on hosts with SSD
Fabrizio Cuseo
2018-01-09 09:26:14 UTC
Permalink
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.

Regards, Fabrizio
--
---
Fabrizio Cuseo - mailto:***@panservice.it
Direzione Generale - Panservice InterNetWorking
Servizi Professionali per Internet ed il Networking
Panservice e' associata AIIP - RIPE Local Registry
Phone: +39 0773 410020 - Fax: +39 0773 470219
http://www.panservice.it mailto:***@panservice.it
Numero verde nazionale: 800 901492
Thomas Lamprecht
2018-01-09 09:42:35 UTC
Permalink
Hi,
Post by Fabrizio Cuseo
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]:
"swappiness

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.

cheers,
Thomas

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

Loading...