For create_swap.sh
script
- run the script
chmod +x create_swap.sh
./create_swap.sh
if everything is ok, we should see something like this
Memory: 2048 MB
Swap: 4096 MB
if there is no swap file, we should see something like this
Memory: 2048 MB
Swap: 0 MB
if there is already a swap file, we should see something like this
Memory: 2048 MB
Swap: 4096 MB
If we want to do this manually without the scrip
-
check the swap file
sudo swapon --show
-
delete the swap file
sudo swapoff -a
sudo rm /swapfile
sudo sed -i '/swapfile/d' /etc/fstab
Then check the memory again
free -m