Ubuntu 18 Swap Space
Category: Linux
Setting up and understanding Swap Space on Ubuntu 18.04
What is Swap Space
Swap Space is disk space that is used once all of your RAM has been used. On Windows devices this has always been a trick to get more out of your PC. On Linux/Ubuntu, it is just the same but commands have changed.
Ram Amount
A general rule of thumb is that you should be upgrading RAM if memory is full during server peak load. But if you do not have the funds, and today disk space is generally cheap, you want to keep swap space around the same as current RAM usage, but be careful as the speed of the memory on disk will not be as powerful as your memory modules.
Setting up the Swap File
$ sudo fallocate -l 1G /swapfile
$ sudo chmod 600 /swapfile
$ sudo mkswap /swapfile
$ sudo swapon /swapfile
$ sudo nano /etc/fstab
$ /swapfile swap swap defaults 0 0