How to Remove a Swap Partition

Check Current Swap Usage

# swapon --show

Disable Swap

# swapoff /swapfile
# swapon --show

Remove Swap Entry

Delete the line corresponding to the swap partition

# vim /etc/fstab
/swapfile swap swap  defaults          0       0 #delete it

Permanently deletes the swap partition file location

# rm -rf /swapfile

Reboot

# reboot

It’s a good idea to reboot your system to apply all changes and clear any leftover references to the removed swap partition.

Leave a Reply

Your email address will not be published. Required fields are marked *