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?
dalto
October 23, 2026, 9:55pm
2
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?
ionmich
October 23, 2026, 10:17pm
3
Well if it is in use why does not show as being modified more recently?
dalto
October 23, 2026, 10:17pm
4
What does the command swapon show?
ionmich
October 24, 2026, 12:04am
5
[ion@Desk ~]$ swapon
NAME TYPE SIZE USED PRIO
/swapfile file 512M 0B -1
[ion@Desk ~]$
dalto
October 24, 2026, 12:59am
6
Yes, that is your swapfile and it is in use.
Thanks. I will leave it alone.