Removing a Swap File or Swap Partition

To remove a swap file or swap partition from use:

  1. Disable swapping to the swap file or swap partition, for example:

    sudo swapoff /swapfile
  2. Remove the entry for the swap file or swap partition from /etc/fstab.

  3. Optionally, remove the swap file or swap partition if you no longer need it.