# unswapping swapfile after delete

## eccerr0r

I did something really stupid, basically it's:

mkswap swapfile

swapon swapfile

rm swapfile

(don't ask why I deleted it.  actually sure, I copied it by mistake when backing it up, and I deleted one to make sure it it's not used for diff compares.  I deleted the wrong one.)

Now I can't swapoff swapfile so I can unmount the partition.

Any way to force swapoff of a swapfile that got deleted?

I'm afraid I might have some RAID5 corruption as I can't swapoff from this file, thus can't unmount the partition, and shut the RAID down safely...

----------

## Rob1n

You could try "swapoff -a".

----------

## eccerr0r

 :Sad: 

```
root@doujima:~# swapoff -V

swapoff: mount-2.12r

root@doujima:~# swapoff -a

root@doujima:~# cat /proc/swaps

Filename                                Type            Size    Used    Priority

/store/swapfile\040(deleted)            file            524280  220     -2

root@doujima:~# 
```

----------

## Rob1n

Hmm, all I can suggest then is remounting your filesystem(s) as read-only which should prevent any corruption during shutdown:

```

mount -o remount,ro /store

```

----------

