###STEPS TO CREATE / EDIT /REMOVE SWAPFILE
-
check swap =
sudo swapon --show
-
turn swap off =
sudo swapoff -v /swapfile
-
create file =
sudo fallocate -l 4G /swapfile
-
give permission =
sudo chmod 600 /swapfile
-
create swap file system =
sudo mkswap /swapfile
-
turn on swap =
sudo swapon /swapfile
-
remove swapfile=
sudo rm /swapfile
-
swapfile mention location =
/etc/fstab (edit this file with root access with editor of your choice and edit or remove entry [not file])
-
check swappiness value =
cat /proc/sys/vm/swapiness
-
change swappiness =
sudo nano /etc/sysctl.conf {add line "vm.swappiness=10" replace 10 by your number }
##Note:
less swappiness== more ram use
its better to delete and create new swap file instead of editing