okecity.com

Update swap memory ubuntu

Update swap memory ubuntu

Step 1 – Checking the System for Swap Information

sudo swapon --show

If you don’t get back any output, this means your system does not have swap space available currently.

You can verify that there is no active swap using the free utility:

free -h

 Step 2 – Checking Available Space on the Hard Drive Partition

df -h

Step 3 – Creating a Swap File 

sudo fallocate -l 1G /swapfile
ls -lh /swapfile

Step 4 – Enabling the Swap File 

sudo chmod 600 /swapfile
ls -lh /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
sudo swapon --show

We can check the output of the free utility again to corroborate our findings:

free -h 

Step 5 – Making the Swap File Permanent 

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

Category: Tekno

Share: