How can I help

Stay informed and learn

Let's connect

How to add SWAP space on Ubuntu/Debian Linux server?

SWAP is virtual memory outside of installed physical memory (RAM).

Check the system to see if SWAP information already exists:

free -h
sudo swapon --show

Check free space on the partition:

df -h

Create a SWAP file:

sudo fallocate -l 1G /swapfile
sudo chmod 600 /swapfile

SWAP file permission check:

ls -lh /swapfile

Enable SWAP space:

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

Optimizing SWAP settings:

sudo nano /etc/sysctl.conf

Add to the bottom of the file vm.swappiness=10 and vm.vfs_cache_pressure=50.

Newer post

How to add Google fonts to Ubuntu/Debian Linux system?

Older post

How to change symbolic link permissions on Linux?

comments powered by Disqus

Looking for an IT professional?

Book a call Email me