• Please be aware: Kaspersky Anti-Virus has been deprecated
    With the upgrade to Plesk Obsidian 18.0.64, "Kaspersky Anti-Virus for Servers" will be automatically removed from the servers it is installed on. We recommend that you migrate to Sophos Anti-Virus for Servers.
  • 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.

Issue Swap partition stuck on 1Gb

technique-web

New Pleskian
Hi,

By default my server (debian 10) came with 1Gb of swap. I ran this :
Code:
dd if=/dev/zero of=/swap bs=1M count=8000
mkswap /swap
chmod 0600 /swap
swapon /swap
Runnig htop shows the new swp size : 8Gb !
But in plesk monitor I still have only 1Gb. After a server reboot, both htop and plesk show 1Gb !!
How can I force the system to keep the new swap partition ?
 
Is your swap partition normally named swap or not rather tmp? What is its entry in /etc/fstab? There should be an entry similar to:
/filesystems/tmp_fs /tmp ext3 noexec,nosuid,loop 0 0
I think one problem could be that with your mkswap command you switch from an existing swap space to a new one, but if the existing swap space is not named "swap" in fstab, after a reboot, the "old" one is active again.
 
This what I have :
Code:
cat /etc/fstab
# /etc/fstab: static file system information.
UUID=af5f8c82-a495-40e0-b3e6-f361abeec5a4    /    ext4    errors=remount-ro    0    1

//swapfile none swap sw 0 0
I really don't see how to read the result !!
 
What it shows is that there is no swap partition defined, only one partition for everything.

It is difficult and risky to change the size of an existing partition to get some free space for an extra swap partition. So the way to do it is normally to create a swap file and then register that as a swap "partition" in fstab so that everytime when you reboot, the system knows that this is its swap space. But I cannot support this here, it's too risky and depends on your system.
 
Thank you for the explanation.
Another question : I've noticed swap is used even if there is over 60% of RAM is free !! It's like Pleks is using swap instead of RAM. How can you explain this please ?
 
At this time, when you look, you might see 60% free RAM. But are you sure that at all times there has always been 60% free RAM? There might have been a very brief moment where a lot of data was moved around so that swap was used. It is a normal thing that can happen. It does not mean that this portion of data in memory is constantly used. It will simply sit there, and it might never be needed again. That's fine.
 
It's like Pleks is using swap instead of RAM

Please note: It's not Plesk that is managing the RAM, it's the OS.
And Linux usually uses all available RAM (and that's a good thing!), see also: Help! Linux ate my RAM!

If you are really concerned about your swap usage you could do:
echo 'vm.swappiness = 1' >>/etc/sysctl.conf
And then reboot your server.
 
Last edited:
Back
Top