How to permanently disable swap file? [duplicate]
Solution 1:
This is how to disable the swap file in Ubuntu 17.04
To turn off the swapfile. Run the following command:
sudo swapoff /swapfile
Now disable the swap file in /etc/fstab
. I'm using Vim.
sudo vim /etc/fstab
Your /etc/fstab
file should have a '#' in front of '/swapfile'
After this is done. save your changes and exit.
Now we're going to physically remove the swap file. run the following command:
sudo rm -f /swapfile
and voila! For the changes to take full effect, reboot the system, and use the 'free' command to confirm there is no available space for swap.
Solution 2:
Any swap file or partition that starts at boot is in the /etc/fstab
file. If you remove the line associated with that swap file in the fstab
it won't start up again after a reboot.