Adding Swap Memory to an Ubuntu Server

This is tested on Digitalocean instance

sudo fallocate -l 4G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
free -h

Make it Permanent

sudo cp /etc/fstab /etc/fstab.bak
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab


About

My name is Omar Qunsul. You can find me on Linkedin.

I write these articles mainly as a future reference for me. So I dedicate some time to make them look shiny, and share them with the public.


Homepage