How to Remove a Swap File in Linux

To remove a swap file: 1 - At a shell prompt as root, execute the following command to disable the swap file (where /mnt/swapfile01 is the swap file):

swapoff -v /mnt/swapfile01
2 - Remove its entry from the /etc/fstab file. 3 - Remove the actual file:
rm -f /mnt/swapfile01