I’ve encountered an issue when increasing the swap space of a KVM guest by resizing it using the Web interface. I changed it from 4GiB to 8GiB, but it failed (I stupidly didn’t note the error at the time, but it was related to swapon failing). Interestingly, Webmin Action Log didn’t record it either. The KVM guest is running RHEL 8.5.
I can see that the 4GiB partition exists, with the 8GiB device:
$ fdisk -l
Disk /dev/vda: 320 GiB, 343597383680 bytes, 671088640 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x4152b3b0
Device Boot Start End Sectors Size Id Type
/dev/vda1 2048 671088639 671086592 320G 83 Linux
Disk /dev/vdb: 4 GiB, 4294967296 bytes, 8388608 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00076e34
Device Boot Start End Sectors Size Id Type
/dev/vdb1 2048 16775167 16773120 8G 83 Linux
instead of increasing swap increase the ram allocation. a properly running machine should not swap on a regular basis…especially requiring a swap increase.
It’s also a very expensive and usually unfeasiable way to manage memory contraints. I suppose in an ideal world I would have 128GiB of memory for each VPS
I told you how to fix it. a properly c configured and running machine should not swap. if you are having to add swap you either have a misconfiguration or you simply…need…to…add…more…ram. Right now I have 50 plus domains on a server that is using a total of 7 gigs of ram. I do not have anything running except apache, PHP, mysqlk. I have everything else disabled. so if you have 4 gigs of ram and you are having to increase swap then for some reason you do not have enough ram.
Thanks for your input, but you didn’t help with my problem. I just needed to figure out how to get the swap partition back up and running.
If you’re really interested, this is a single domain - a busy WordPress website - server memory on the web server between 16 -24 GiB depending on traffic. When I increased the disk space on the server, I noticed that I hadn’t increased swap from 4GiB, and as it gives breathing space for spikes in traffic, considered this too low. So I increased it to 8 GiB, but this failed for some reason (refer to the solution if you’re interested in how I fixed it).
And if you’re interested in the bottleneck: it is the php-fpm processes that chew up the memory, size inflated by WordPress plugins. And regarding turning everything off, I’m running a distributed infrastructure, with mariadb, varnish, redis on separate servers, so likely even leaner than what you have set up.