Ubuntu 20+ Add swap space

How to add Swap space on Ubuntu

 · 1 min read

Create a swap file

sudo fallocate -l 2G /swapfile


sudo chmod 600 /swapfile


sudo mkswap /swapfile


Output

Setting up swapspace version 1, size = 2 GiB (2147479552 bytes)

no label, UUID=fde7d2c8-06ea-400a-9027-fd731d8ab4c8


sudo swapon /swapfile

vim nano /etc/fstab

Add this line

/swapfile swap swap defaults 0 0


sudo swapon --show

Output

NAME      TYPE      SIZE  USED PRIO

/swapfile file        2G    0B   -1


sudo free -h


Output

             total        used        free      shared  buff/cache   available

Mem:          981Mi        97Mi        68Mi       0.0Ki       814Mi       735Mi

Swap:         2.0Gi        10Mi       1.9Gi



More details https://linuxize.com/post/how-to-add-swap-space-on-ubuntu-20-04/




Cloud support

Cloud support team provides hosting related support and technology updates. Cover technology like cloud printing, Cloud PBAX, VoIP, Kubernetes, Ubuntu, Linux etc. Contact us on support@ERPGulf.com

No comments yet

No comments yet. Start a new discussion.

Add Comment