4

I am trying to delete the swap file by the following link:

https://www.digitalocean.com/community/questions/delete-swap-file

However, when I type:

sudo rm /swapfile

I am getting the following error:

rm: cannot remove `swapfile': Operation not permitted

I have changed the permissions on the swap file to 777 and I believe I have root privileges, But still not able to delete it.

khalidh
  • 185

1 Answers1

4

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' /etc/fstab
khalidh
  • 185