My RAM is 16GB, I think I can’t set swap for example 20GB as you mentioned, can I? If yes, why?. I still don’t understand what is swap space. I use swap space, which uses RAM so basically I let my RAM to give to swap his 14GB of RAM, which swap tool will use to clean and try to provide as much as it can from this 14GB instead of normally use 14+2 GB RAM(beacuse it doesn’t have that much, fast cleaning mechanism and in my case it crashes) does it correct?
Could I have any pros of creating 2-3 swapon files of maximum 16GB(together) on the same ONE RAM? Or how to check if on this computer I have two seprated 2x 8GB? I don’t want to take cover off.
If you want to alter it permanently then you need to change the vm.swappiness parameter in the /etc/sysctl.conf file.
/etc/sysctl.d cat /etc/sysctl.conf ✔
cat: /etc/sysctl.conf: No such file or directory
I can’t access this file, why? Should I create it by myself?
From version 207 on, systemd will not apply the settings from /etc/sysctl.conf anymore: it will only apply those from /etc/sysctl.d/*. Since the settings of our /etc/sysctl.conf shipped by procps-ng have become kernel defaults anyway, we have decided to deprecate this file.
On my system in /etc/sysctl.d/
I have a file called 99-sysctl.conf with the following added:
# Decrease swap usage to a more reasonable level
Swap doesn’t use RAM. It’s a way of extending RAM using storage devices such as HDDs and SSDs. It also allows more efficient use of RAM, and hibernation.
You have 16GiB RAM + 14GiB swap, so you have 30GiB of virtual memory. When you only had 20GiB of virtual memory you were running out.
Swap is slower than RAM, but better than crashing or having things you’re working on closed. HDDs are a bit too slow, SSDs are much better.
Multiple swap files/partitions are fine, but preferably on separate drives. If you’re going to put them all on the same drive then it’s probably better to make a bigger swap file instead. Having them on separate drives makes swap faster, see the Priority and Striping sections at the bottom of this link.