PVE node SWAP usage - vm.swappiness configuration script #2419

Open
opened 2026-02-05 04:46:52 +03:00 by OVERLORD · 7 comments
Owner

Originally created by @heinemannj on GitHub (Jan 30, 2026).

🌟 Briefly describe the feature

Add support for vm.swappiness configuration

📝 Detailed description

To apply vm.swappiness change on a PVE node immediately, but not persistant:

sysctl -w vm.swappiness=0

For persistant change modification of /etc/sysctl.conf:

cat <<EOF > /etc/sysctl.conf
vm.swappiness = 0
EOF

💡 Why is this useful?

PROXMOX VE node default settings for SWAP usage:

Size: 8GB
vm.swappiness=64

Results in regular Netdata alerts because the PVE node SWAP usage is above 98%.
I think almost every Promox HomeLab user is facing this kind of issues too.

After the change the swap usage in most of my LXCs is under 0.1%.
https://forum.proxmox.com/threads/swap-usage-100.109491/post-780661

Only a few bestie LXCs are consuming much more (1-100%).

Image Image
Originally created by @heinemannj on GitHub (Jan 30, 2026). ### 🌟 Briefly describe the feature Add support for vm.swappiness configuration ### 📝 Detailed description To apply vm.swappiness change on a PVE node immediately, but not persistant: `sysctl -w vm.swappiness=0` For persistant change modification of `/etc/sysctl.conf`: ``` cat <<EOF > /etc/sysctl.conf vm.swappiness = 0 EOF ``` ### 💡 Why is this useful? PROXMOX VE node default settings for SWAP usage: ``` Size: 8GB vm.swappiness=64 ``` Results in regular Netdata alerts because the PVE node SWAP usage is above 98%. I think almost every Promox HomeLab user is facing this kind of issues too. After the change the swap usage in most of my LXCs is under 0.1%. https://forum.proxmox.com/threads/swap-usage-100.109491/post-780661 Only a few bestie LXCs are consuming much more (1-100%). <img width="721" height="365" alt="Image" src="https://github.com/user-attachments/assets/55c0823a-db4d-4760-be4d-7a1031af1b9a" /> <img width="1901" height="867" alt="Image" src="https://github.com/user-attachments/assets/18c47d9d-9bc6-4da5-ae05-8467c212a6e6" />
OVERLORD added the enhancement label 2026-02-05 04:46:52 +03:00
Author
Owner

@MickLesk commented on GitHub (Jan 30, 2026):

Thanks for the suggestion. However, this is better suited as a documentation/guide rather than a script feature.

main Reasons:

  • This is a PVE host-level configuration, not container-related
  • swap configuration is highly subjective and depends on individual use cases
  • Its a simple 2-command change that doesn't warrant automation
  • Some users prefer no swap at all

me as example, ive removed swap completly from my main node, because it caused more problems than it solved. Only my DEV node still runs swap to test scripts that require it.

@MickLesk commented on GitHub (Jan 30, 2026): Thanks for the suggestion. However, this is better suited as a documentation/guide rather than a script feature. main Reasons: - This is a PVE host-level configuration, not container-related - swap configuration is highly subjective and depends on individual use cases - Its a simple 2-command change that doesn't warrant automation - Some users prefer no swap at all me as example, ive removed swap completly from my main node, because it caused more problems than it solved. Only my DEV node still runs swap to test scripts that require it.
Author
Owner

@heinemannj commented on GitHub (Jan 30, 2026):

Based on my investigations:

  • PVE host-level configuration are container-related as well - clearly seen in most of my LXCs ...
  • Having an automated question and answer game will simplify the configuration for not so experienced users

Second point:

  • The mayority of our users are searching in Proxmox VE Helper-Scripts Web-GUI first and most likely NOT in the discussion areas ...

Question:
How to removed swap completly from a PVE node?

@heinemannj commented on GitHub (Jan 30, 2026): Based on my investigations: - PVE host-level configuration are container-related as well - clearly seen in most of my LXCs ... - Having an automated question and answer game will simplify the configuration for not so experienced users Second point: - The mayority of our users are searching in Proxmox VE Helper-Scripts Web-GUI first and most likely NOT in the discussion areas ... Question: How to removed swap completly from a PVE node?
Author
Owner

@MickLesk commented on GitHub (Jan 30, 2026):

with swapoff -a

My concerns are here:

  1. vm.swappiness is highly environment-specific - what works for one setup may cause issues for another. The "right" value depends on workload, available RAM, storage type (SSD vs HDD), and use case.

  2. Host-level configuration with significant impact - automating this could lead inexperienced users to change critical system settings without fully understanding the implications.

I think this would be better served as documentation or a discussion post with:

  • Explanation of what vm.swappiness does
  • Different scenarios and recommended values
  • How to monitor swap usage properly
  • When to add more RAM vs. tune swap settings

That said, I'd be interested to hear what other @community-scripts/contributor think about this. If there's broader consensus that this would be valuable as an automated feature, I'm open to reconsidering.

@MickLesk commented on GitHub (Jan 30, 2026): with swapoff -a My concerns are here: 1. vm.swappiness is highly environment-specific - what works for one setup may cause issues for another. The "right" value depends on workload, available RAM, storage type (SSD vs HDD), and use case. 2. Host-level configuration with significant impact - automating this could lead inexperienced users to change critical system settings without fully understanding the implications. I think this would be better served as documentation or a discussion post with: - Explanation of what vm.swappiness does - Different scenarios and recommended values - How to monitor swap usage properly - When to add more RAM vs. tune swap settings That said, I'd be interested to hear what other @community-scripts/contributor think about this. If there's broader consensus that this would be valuable as an automated feature, I'm open to reconsidering.
Author
Owner

@heinemannj commented on GitHub (Jan 30, 2026):

swapoff -a on an PVE node is persistant?

"... This is a PVE host-level configuration, not container-related ..."

  • Yes - you are right:
root@esphome:~# sysctl vm.swappiness
vm.swappiness = 60

"... That said, I'd be interested to hear what other @community-scripts/contributor think about this. If there's broader consensus that this would be valuable as an automated feature, I'm open to reconsidering. ..."

OK - make sense - How to proceed?
Open a new discussion or let this case open to discuss here?

@heinemannj commented on GitHub (Jan 30, 2026): `swapoff -a` on an PVE node is persistant? _"... This is a **PVE host-level configuration, not container-related ..."**_ - Yes - you are right: ``` root@esphome:~# sysctl vm.swappiness vm.swappiness = 60 ``` _"... That said, I'd be interested to hear what other @community-scripts/contributor think about this. If there's broader consensus that this would be valuable as an automated feature, I'm open to reconsidering. ..."_ OK - make sense - How to proceed? Open a new discussion or let this case open to discuss here?
Author
Owner

@tremor021 commented on GitHub (Jan 30, 2026):

swapoff -a disables it right away, but its not persistant. You will need to edit fstab for it to stay that way. But as most of PVE nodes stay running until they die, i can see why swapoff -a can be a solution to some.

@tremor021 commented on GitHub (Jan 30, 2026): `swapoff -a` disables it right away, but its not persistant. You will need to edit fstab for it to stay that way. But as most of PVE nodes stay running until they die, i can see why `swapoff -a` can be a solution to some.
Author
Owner

@grimwiz commented on GitHub (Feb 3, 2026):

disk space is so much cheaper than real ram, it makes sense to scale swap. The memory usage of a starting application often creates dirty pages whilst the application works its way into a "business as usual" mode, that memory is never used again and it makes sense to push it off to disk.

@grimwiz commented on GitHub (Feb 3, 2026): disk space is so much cheaper than real ram, it makes sense to scale swap. The memory usage of a starting application often creates dirty pages whilst the application works its way into a "business as usual" mode, that memory is never used again and it makes sense to push it off to disk.
Author
Owner

@CrazyWolf13 commented on GitHub (Feb 4, 2026):

yeah I agree, also with the ram prices becoming higher and higher.
For example on those node apps, where it just needs once some RAM and some SWAP for the initial build but no longer while just running the app, I think it's fine without messing with swap on the host.

We should also consider not to change too much on the host with our scripts. Anyone that does however want to do this is fully open to customzie their Proxmox Installation however they want and you are welcome to create a guide/discussion from this.

@CrazyWolf13 commented on GitHub (Feb 4, 2026): yeah I agree, also with the ram prices becoming higher and higher. For example on those node apps, where it just needs once some RAM and some SWAP for the initial build but no longer while just running the app, I think it's fine without messing with swap on the host. We should also consider not to change too much on the host with our scripts. Anyone that does however want to do this is fully open to customzie their Proxmox Installation however they want and you are welcome to create a guide/discussion from this.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/ProxmoxVE#2419