• We value your experience with Plesk during 2024
    Plesk strives to perform even better in 2025. To help us improve further, please answer a few questions about your experience with Plesk Obsidian 2024.
    Please take this short survey:

    https://pt-research.typeform.com/to/AmZvSXkx
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Question increase swap file

Bjorn

Basic Pleskian
Hi,

We upgraded server RAM to 16gb. Now the cache has more space to fluctuate.

But our swap is still used and we recieve swap usage alarms. Plesk recommends the swap storage to be 1/2 of the total ram space. So our swap needs to be 8GB.

I increased the swap by removing the current swap file: /dev/dm-1

Code:
swapoff /dev/dm-1
rm -f /dev/dm-1


Created new swap file:
Code:
dd if=/dev/zero of=/swapfile bs=1M count=8192
chmod 600 /swapfile
mkswap /swapfile


Add swap file for boot include:
Code:
vi /etc/fstab
/swapfile    swap    swap   defaults 0 0


Activate new swap file
Code:
swapon /swapfile

----
This all works fine and we now have an 8GB swap file.

But after a reboot I noticed the old swap is recreated and used next to the new swap file.
Where do I remove the old swap file (dev/dm-1) reference?

Thanks.
 
Hi Bjorn,

It seems to me not a Plesk-specific issue because it is not a swapfile created by Plesk (like a "/pleskswap" file). If I am not mistaken, the server has a dedicated partition for a swap on the HDD device.
Could you please show `grep swap /etc/fstab` and `fdisk --list`?
 
Hello! I am having the same issue here.

What I see is that some parts of Plesk are aware of the new size of the swap file (Tools & Settings > Server Information).

But under Advanced Monitoring the "Thresholds" used for the graph features are percentages based off of the original value. When I go to update the threshold value for the swap graph its default value is 80%. But 80% of what? I think that is where the issue lies.

It is still 80% of the smaller size and so it keeps triggering the warnings. The warnings are issued by Plesk feature so they are a Plesk issue. The OS reports the correct swap size and usage. Plesk is generating alerts based on outdated information. I hope there is a way to update this value somewhere.
 
After a bit more searching found a link posted by Peter Debik
In my case the "Restart Integration" button was there and tool care of the graph issue. Will now have to wait and see it warnings keep being generated.

After doing this a new Notices was generated "[OK] Swap usage"
 
Hi OWEUX LLC,

Looks like it is not the same issue because Bjorn asked about "Where do I remove the old swap file (dev/dm-1) reference?". Plesk doesn't manage swap partitions as "/dev/dm-1".

Regarding your questions:
> But 80% of what? I think that is where the issue lies.
Of swap size that is known for Advanced Monitoring. The "known size" could be found on one of the Advanced Monitoring graphs.

I agree info about "size of swap" could be outdated in some cases. A new feature that helps update information about hardware resources will be available with the next Advanced Monitoring (v1.3.1) release.
 
How do I find the current swap folder to delete?
/dev/dm-1/ doesnt exist on CentOs 8

I am getting bombarded by alerts about swap usage and Plesk support won't help me because they say Plesk doesn't manage the swap... So I just keep receiving 50 alerts every day.
 
Plesk recommends the swap storage to be 1/2 of the total ram space.
Where exactly does it say that?

I have a server with 128 GB RAM and my Swapfile is 4 GB and used currently only 25 MB. In CentOS 8.2 with NVMe-SSD.
 
It depends on how much RAM your system has and how much RAM is actually used. I'm no expert, but the swapfile is for when you have too less RAM, because otherwise the important RAM will be filled with unnecessary data. How much RAM do you have? And have you looked at how much swap file is actually being used? You can see it on my system. I have 128 GB RAM and only 25 MB (Megabyte) is used in my 4 GB swapfile (CentOS 8.2 default).

Do you need swap if you have lots of RAM?
This is a good question indeed. If you have 32GB or 64 GB of RAM, chances are that your system would perhaps never use the entire RAM and hence it would never use the swap partition.
Source How Much Swap Should You Use in Linux? - It's FOSS

Look here "10.2. Recommended system swap space" Chapter 10. Getting started with swap Red Hat Enterprise Linux 8 | Red Hat Customer Portal
There is also well described how to change or correctly delete the swapfile.
 
Last edited:
Back
Top