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, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content