How to Increase Virtual Memory

Operating system Ubuntu Linux 18.04.5

Webmin version 1.981 Usermin version 1.823
Virtualmin version 6.17-3


I am looking for a way to increase my swap size in virtual min.

I’ve attached screenshots of the memory. I would like to know how to increase the VM and also how much, I’m assuming it should be 8GB. Please don’t link ubuntu tutorials on how to do this, I’m looking to do it directly through Virtual Min if possible. I have tutorials on how to do it through Ubuntu already but I’m worried about conflicts with the virtual min system.



Virtual memory “should” be whatever you need it to be. Many systems don’t have virtual memory at all. Since you have a lot of free real memory, I wouldn’t worry too much about virtual memory.

It is not harmful to have virtual memory 100% full and is not necessarily indicative of a problem.

But, if you do want to have more virtual memory, you can create a swap file.

1 Like

Feature request: could we not have a simple slider to increase / decrease virtual memory via the Virtualmin GUI? It is used by almost everyone so it would be one less thing for a Virtualmin admin to do via CLI if virtual memory allocation could be done via GUI. Thanks in advance. :slight_smile:

I tend to want to avoid adding anything to the UI that is “only needed once, and maybe never”. Swap is an install time decision for most folks. It’s a compromise for folks who want a tiny/cheap VM that’s running more stuff than is really appropriate for the size of the VM.

It’s entirely reasonable to have a system without swap, as long it has enough real memory. We added creation of swap at Virtualmin install time only because we know it often gets installed on very, very, small systems and it was a really bad/confusing experience to have services randomly killed by the OOM killer immediately after installation.

It’s clever, but I think our focus at this point in history should be removing stuff from the UI, making it simpler and harder to mess up, rather than adding more stuff. But, also I don’t think you can safely resize swap files in realtime, I think you have to unmount, recreate, remount. Giving that kind of process a slider is a recipe for disaster…crazy amount of code to accommodate making it safe while also being responsive.


Thanks Joe for the reasoned explanation.

@dlogic22 I agree with @Joe as swap size is installation time call decision however since couple of years on server I start using different option to be able change swap area on demand.

I can see you have tons or real ram so you have option to reduce swappiness from 60 to 20 or perhaps 10, then reboot and your server will use more real ram instead of swap. The other option is if you have enough space on your /root to use swap file instead of swap partition… point is you can change size of it on demand at any time without reinstallation or without messing with partitions. And it work just like /swap. You can have it even now and replace your /swap partition with it and then disable /swap partition and remove from fstab. Next time when you deploy new server you just install with swap small like 2gigs or ress and then repeat process or if you know how to install it without swap partition (i have no idea if you do), go with that option.

there is no way to do it from virtualmin gui and I dont think that would be good idea even if that was even possible.

I hope so that will helps.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.