How do I remove a swap file in Red Hat Enterprise Linux?

Updated -
  1. At a shell prompt as root, execute the following command to disable the swap file (where /swapfile is the swap file):

    swapoff /swapfile
    

  2. Remove its entry from /etc/fstab.

  3. Remove the actual file:

    rm /swapfile

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.