Proxmox

Proxmox Swap Tweaks Guide! Dedicated drive, Swappiness, Page Cluster

Learn about Proxmox Swap and how to set up dedicated storage for ultra fast swap performance with Intel Optane drives.

I have been doing quite a bit of testing with Proxmox swap and Intel Optane drives for ultra fast swap storage. In doing so have learned quite a bit about configuring your Proxmox swap drive to use dedicated storage, tweak the swappiness value, and other configuration settings that can definitely have a major impact on performance at least making it where you can truly have extremely fast and efficient swap for your Proxmox host.

What is Proxmox swap?

First of all, what is Proxmox swap and what is it used for? The Proxmox swap space is space configured in a Proxmox Virtual environment that acts like virtual memory. It is used when the system’s physical RAM is fully used up. Swap allows the operating system to unload inactive memory pages from RAM to disk. This helps to keep things from crashing or slowing down dramatically when memory is completely used up.

Proxmox can have a couple of different types of swap space that is configure. Swap can be configured at both the host level (on the Proxmox VE node which is what we will be looking at), and at the virtual machine level or containers (LXC).

If you look at the official documentation, swap is not meant to replace your true system memory as typically disk operations are much slower than RAM. You can keep an eye on how much swap space is used by looking at the command line:

free -m

You can also see this in the Proxmox web interface. When you click on your Proxmox node > Summary screen > Swap usage, you will see a current view of how much swap space is being used.

Viewing proxmox swap space from the proxmox gui
Viewing proxmox swap space from the proxmox gui

Viewing swap and turning off the default swap

Let’s take a look at how to view Proxmox swap for the system and how we can turn off the default swap space. First, to view the configured swap in our Proxmox system, run the command below:

swapon --summary

As you can see below, we see the default 8 GB partition that is configured when we install Proxmox. This will use the same disk that your Proxmox installation uses.

Viewing the swapon summary command for default proxmox swap values
Viewing the swapon summary command for default proxmox swap values

Next, if we want to disable the configured swap space that is set up by default, we can run the command:

swapoff -a

This command will say that any swap space that is currently configured we want to turn it off. Since we only have the default Proxmox swap space configured, this is fine as we want to turn this off and assign some fast dedicated storage for this purpose.

Configuring Proxmox swap to use a dedicated disk

Now, let’s say we want to use a dedicated drive for our Proxmox swap. I have been experimenting with Intel Optane storage that is blazing fast and that has super low latency and high IOPs. Optane mimics memory in many ways. So this is what I would like to use for my Proxmox swap space.

Turning the default proxmox storage off
Turning the default proxmox storage off

We need to find the disk that we want to use for our dedicated swap space. You can do that with the command:

lsblk

Below, in the output for the lsblk command, I want to use the nvme0n1 device since this is my Intel Optane storage.

Listing out the local storage attached to the proxmox host
Listing out the local storage attached to the proxmox host

To use this drive for dedicated swap storage, we can use the command:

mkswap /dev/nvme0n1
Running the mkswap command for the intel optane drive
Running the mkswap command for the intel optane drive

Now, to make this persistent, we need to add this drive to the fstab file located at /etc/fstab.

echo "/dev/nvme0n1 none swap sw 0 0" | tee -a /etc/fstab
Making the drive persistent for dedicated swap storage
Making the drive persistent for dedicated swap storage

Verify new swap space and comment out the old swap

Below I am using nano to edit the /etc/fstab file. Here I am commenting out the default swap storage:

#/dev/pve/swap none swap sw 0 0

And, we can see the new swap space has been added:

/dev/nvme0n1 none swap sw 0 0
Comment out the old swap space and make sure the new swap has been added for proxmox swap
Comment out the old swap space and make sure the new swap has been added for proxmox swap

Checking our free memory and swap space

Now that we have done this, we can check our free memory which also shows the swap space configured using the command:

free -m
Checking free memory and available swap space
Checking free memory and available swap space

What is swappiness?

It may not sound like it, but the term “swappiness” is actually a real thing in the Linux world, I love the terminology! The swappiness value is a Linux kernel parameter. It controls how agressively the system uses swap space when it manages memory.

Swappiness is configured using a number between 0 and 100. The lower the value or closer to 0, it means the system prioritizes keeping data in RAM and only use swap if it is absolutely necessary. Higher values, or values closer to 100 encourage the system to use more frequent swapping of inactive memory pages to disk.

The default swappiness value in Linux, including Proxmox is 60. This is a value that balances RAM with swap utilization. In a system with plenty of memory and if you are running virtual machines and containers that can be quite sensitive to latency, some may even decrease the swappiness value.

However, if you have a memory-starved host which is often the case in a home lab, and you are using fast swap storage like intel optane, increasing the swappiness value to something between 75-90 helps to make sure the system offloads as many memory pages as it needs to fast Intel Optane storage, freeing up as much memory as possible.

You will need to monitor and test these settings out in your particular environment to find the balance of performance and memory use.

Checking and configuring the swappiness value

There are a couple of ways to check the current swappiness value. You can do this with the command:

cat /proc/sys/vm/swappiness

Or you can use the command:

systemctl vm.swappiness
Checking the current swappiness value for proxmox
Checking the current swappiness value for proxmox

Now, let’s see how we configure the swappiness value. We can do this with the command:

sysctl -w vm.swappiness=75
Setting the swappiness value for proxmox swap
Setting the swappiness value for proxmox swap

We can make this change permanent with this command:

# Make the change permanent
echo "vm.swappiness=70" | tee -a /etc/sysctl.conf

# Apply the changes immediately
sysctl -p
Make the change permanent for proxmox swap and apply the changes immediately
Make the change permanent for proxmox swap and apply the changes immediately

Increase page cluster for faster Proxmox swap reads/writes

The vm.page-cluster setting in Proxmox controls how many pages (which are 4kb in size each) the Linux kernel tries to read and write to your swap space at once. The default value is 3 which means Linux will swap in and out 2^n pages (2^3 which equals 8 pages at a time). Optane can handle high IOPS efficiently and doesn’t need this batching operation due to its performance

Setting the vm.page-cluster setting to 0 forces Linux to swap only one page (4kb) at a time instead of bundling these together. If your swap usage is random and latency-sensitive (e.g., high-memory VMs, databases, etc) using vm.page-cluster=0 is preferred. It makes sure you have near RAM speed response from swap and it takes advantage of Optane’s super low latency.

You can set this withthe following:

# Set the page cluster setting
echo "vm.page-cluster=0" | tee -a /etc/sysctl.conf

# Apply changes immediately 
sysctl -p

Build your own Proxmox Home Lab Server in 2025

I have recently completed a build for a Proxmox home lab server in 2025 and it turned out really well. It is the machine that I am using for my swap testing. Here is the bill of materials:

See it on kit.co here:

Wrapping up

Hopefully, this post can serve as a guide if you want to tweak your Proxmox swap space to have the most performance possible using something like a dedicated drive running on Intel Optane or other very fast storage. Optane has near memory latency and is extremely fast. So, it can be used in situations where you want to essentially extend your system memory as far as possible and run more workloads on a memory starved system. Let me know in the comments if you have tweaked on your Proxmox memory configuration. Have you found a configuration that works great for you in the home lab, production, etc?

Subscribe to VirtualizationHowto via Email ๐Ÿ””

Enter your email address to subscribe to this blog and receive notifications of new posts by email.



Brandon Lee

Brandon Lee is the Senior Writer, Engineer and owner at Virtualizationhowto.com, and a 7-time VMware vExpert, with over two decades of experience in Information Technology. Having worked for numerous Fortune 500 companies as well as in various industries, He has extensive experience in various IT segments and is a strong advocate for open source technologies. Brandon holds many industry certifications, loves the outdoors and spending time with family. Also, he goes through the effort of testing and troubleshooting issues, so you don't have to.

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.