Table of Contents

Swap

Sample

## Preparing additional swap memory of 16GB
sudo dd if=/dev/zero of=/var/swap bs=1M count=16384
#sudo mkswap /var/swap
sudo mkswap --label swap /var/swap
sudo chmod 600 /var/swap
sudo swapon /var/swap
#sudo swapoff /var/swap
#swapon -s
cat /proc/swaps
## Filename      Type      Size      Used      Priority
## /var/swap     file      16777212  755516    -2
free -m
##            total      used      free     shared   buff/cache   available
## Mem:        7430      3938      3335          1          156        3282
## Swap:      16383       737     15646

File-System Table

sudo vi /etc/fstab
================================
#LABEL=swap none swap defaults 0 0
/var/swap swap swap defaults 0 0
================================
sudo systemctl daemon-reload
sudo swapon /var/swap

References

https://help.ubuntu.com/community/SwapFaq
https://www.digitalocean.com/community/tutorials/how-to-add-swap-space-on-ubuntu-22-04