Question

delete swap file

Posted March 26, 2014 6.1k views
how to delete a swap file?

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
1 answer
Run the following commands:
sudo swapoff -a -v

sudo rm /swapfile
#back up /etc/fstab:
sudo cp /etc/fstab /etc/fstab.bak
sudo sed -i '/\/swapfile/d'

The commands should work assuming your swapfile is stored in / and is called "swapfile."
Submit an Answer