• Our team is looking to connect with folks who use email services provided by Plesk, or a premium service. If you'd like to be part of the discovery process and share your experiences, we invite you to complete this short screening survey. If your responses match the persona we are looking for, you'll receive a link to schedule a call at your convenience. We look forward to hearing from you!
  • We are looking for U.S.-based freelancer or agency working with SEO or WordPress for a quick 30-min interviews to gather feedback on XOVI, a successful German SEO tool we’re looking to launch in the U.S.
    If you qualify and participate, you’ll receive a $30 Amazon gift card as a thank-you. Please apply here. Thanks for helping shape a better SEO product for agencies!
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

Question increase swap partition on ubuntu 16

Alaa Mansour

Basic Pleskian
Hello everybody,

I have a server with 8GB of RAM, and I keep getting the message:
Advanced monitoring

The swap usage threshold has been exceeded​

now when running this command:
Code:
sudo swapon --show

I get:
Code:
NAME      TYPE      SIZE USED PRIO
/dev/dm-1 partition 1.9G 1.6G   -1

I'm using the VPS of Ionos.com they use SSD disks want to increase the swap space, should I just increase the swap partition? and how to do it?
or should I disable the swap partition and create a swap file? and how to do it?
thank you all very much
 
they told me that they don't do any kind of intervention on the server, as I have complete control over it.
so I would have to do it by myself
 
I wouldn't recommend trying to resize mounted filesystems remotely unless you absolutely know what you're doing, so I guess you're stuck with using a swap file.
See the man pages for mkswap and swapon for how to create and configure such a file. I recommend specifying a lower priority for swapon in fstab because swap file is slower than swap partition.
 
Would not upgrading to more RAM be the correct solution? If you run into swap usage, it is an indication that your RAM is too small. The moment when swap comes into play, the system performance is considerably degraded. Your server can slow down to a point where it feels like it is almost not responding at all. So instead of upgrading the swap space, it may be better to upgrade the RAM.
 
OP didn't write anything about monitoring complaining about RAM usage threshold, so I assume that is not a problem (yet).

Depending on swappiness, linux kernel will swap not recently used application data out in favor of keeping more cache available. This is often faster than keeping code/data in RAM that e.g. is only used at startup/shutdown of that app. So though you have sufficient RAM available or even free (not used for cache/buffers) there may still be swap usage.
 
yeah, as I thought, the "real" RAM usage does not exceed half of physical RAM, the kernel is just swapping out pages it doesn't use much in favor of having more cache during the backup. You can see those pages aren't really needed as they stay swapped out even after cache goes back down after 2:00. If they were accessed, they would be swapped back in.
So, nothing to worry about, just the kernel optimizing use of the available ressources.
 
you can issue following commands as root to add 4GB to swap in a file, so without the need to resize partitions etc.
Code:
# fallocate --length 4G /swapfile
# chmod 600 /swapfile
# mkswap /swapfile
# swapon /swapfile
 
Back
Top