Answers for "how to add swap space on ubuntu 20.04"

0

how to add swap space on ubuntu 20.04

#How To Add Swap Space on Ubuntu 20.04 (digital ocean gist)
sudo swapon --show #to check if swap available
free -h #check available memory
df -h #check disk space
#allocate swap file
sudo fallocate -l 4G /swapfile
#Make the file only accessible to root by typing:
sudo chmod 600 /swapfile
#make swap
sudo mkswap /swapfile
#enable it
sudo swapon /swapfile
#Verify that the swap is available by typing:
sudo swapon --show
#also 
free -h
#Making the Swap File Permanent
sudo cp /etc/fstab /etc/fstab.bak
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
Posted by: Guest on September-28-2021

Code answers related to "how to add swap space on ubuntu 20.04"

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language