How do I add/configure swap?


Hello everyone and pleased to meet you, this is my first post!

I’m not hugely technical but I recently bought a VPS and installed yunohost because I want to make my life online more independent. I have managed to install some instances of software that I want to use (Nextcloud, Searx, EmailPoubelle, Wordpress) but I am also having some problems with stability (sometimes my VPS becomes unresponsive until I restart it) as well as not being able to install other software (e.g Glitch-Soc will start to install but then stops halfway through and does not resume).

When I run a diagnosis on my Yunohost installation I am warned that my system is low on RAM, that ‘the system has no swap at all’ and that I should consider adding it.

Does anyone know how I can add swap?

My level of skill/experience: I have never set up my own hosting before. I can navigate the webadmin. I have beginner-level proficiency with the linux command line.

If anyone can help I would be very grateful :slight_smile:

Thanks in advance

My YunoHost server

Hardware: VPS bought online
YunoHost version:
I have access to my server : Through SSH and through the webadmin

Diagnosis log (system resources section):

System resources (systemresources)

[ERROR] The system has only 32 MiB (3.2%) RAM available! (out of 977 MiB)

[INFO] The system has no swap at all. You should consider adding at least 512 MiB of swap to avoid situations where the system runs out of memory.

  • Please be careful and aware that if the server is hosting swap on an SD card or SSD storage, it may drastically reduce the life expectancy of the device.

[SUCCESS] Storage / (on device /dev/vda1) still has 17 GiB (75%) space left (out of 23 GiB)!

I think 1 GB of RAM is pretty low for all those apps that you want to run.

Try running:
sudo top or sudo htop

Htop is easier to understand visually, so I recommend installing that.

What applications are using a lot of RAM?

Thanks for the the reply and your suggestion. I ran htop but It was hard for me understand many of the listed processes. Nevertheless I found a tutorial which showed me how to add swap memory to my vps which has totally sorted out the problem. I add a link to it here so it may show up in searches for other users.
Still, I feel it would be good if there was some guidance from yuonohost on swap during installation.

1 Like

Glad it is sorted.

When Yunohost installs debian on a physical computer it does seem to make a swap drive.

$ free --mega
               total        used        free      shared  buff/cache   available
Mem:            8238        3510         146         222        4581        4192
Swap:           1023          33         990

It looks like they don’t automatically make a swap file when installing on a VPS? Interesting.

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