System Administration Guide, Volume 1

How to Remove Extra Swap Space

  1. Become superuser.

  2. Use the swap -d command to remove swap space.


    # /usr/sbin/swap -d /path/filename
    

    The swap file name is removed from the list so that it is no longer available for swapping. The file itself is not deleted.

  3. Edit the /etc/vfstab file and delete the entry for the swap file.

  4. Recover the disk space so that you can use it for something else.


    # rm swap-filename
    

    If the swap space is a file, remove it. Or, if the swap space is on a separate slice and you are sure you will not need it again, make a new file system and mount the file system.

    See Chapter 36, Mounting and Unmounting File Systems (Tasks) for information on mounting a file system.

Example--Removing Extra Swap Space

The following examples shows how to delete the /files/swapfile swap file.


# swap -d /files/swapfile
# (Remove the deleted swap entry from the /etc/vfstab file)
# rm /files/swapfile
# swap -l
swapfile             dev  swaplo  blocks   free
/dev/dsk/c0t2d0s1   32,17      8  205624  192720