Can't delete swapfile

There is a file called swapfile in my root directory that was created two months ago and last modified on the same date. I have no idea how it got there. When I try to delete it as root it fails.

[root@Desk ion]# rm /swapfile
rm: cannot remove '/swapfile': Operation not permitted
[root@Desk ion]# 

Could someone explain how a file cannot be deleted?

That is probably your swapfile.

If you deactivate it, you should be able to delete it.

That being said, that is probably not a good idea unless you are planning to replace it with something else.

What does the command swapon return?

Well if it is in use why does not show as being modified more recently?

What does the command swapon show?

[ion@Desk ~]$ swapon
NAME TYPE SIZE USED PRIO
/swapfile file 512M 0B -1
[ion@Desk ~]$

Yes, that is your swapfile and it is in use.

Thanks. I will leave it alone.