OS Manuals

/usr/bin/swapon

Misc binaries for util-linux

From util-linux-misc 2.42.4-r2 (os), captured 2026-11-05 by running swapon --help (exit 0). permalink

Usage:
 swapon [options] [<spec>]

Enable devices and files for paging and swapping.

Options:
 -a, --all                enable all swaps from /etc/fstab
 -d, --discard[=<policy>] enable swap discards, if supported by device
 -e, --ifexists           silently skip devices that do not exist
 -f, --fixpgsz            reinitialize the swap space if necessary
 -o, --options <list>     comma-separated list of swap options
 -p, --priority <prio>    specify the priority of the swap device
 -s, --summary            display summary about used swap devices (DEPRECATED)
 -T, --fstab <path>       alternative file to /etc/fstab
     --show[=<columns>]   display summary in definable table
     --output-all         output all available columns
     --annotate[=<when>]  annotate columns with a tooltip (always|never|auto)
     --noheadings         don't print table heading (with --show)
     --raw                use the raw output format (with --show)
     --bytes              display swap size in bytes in --show output
 -v, --verbose            verbose mode

 -h, --help               display this help
 -V, --version            display version

The <spec> parameter:
 -L <label>             synonym for LABEL=<label>
 -U <uuid>              synonym for UUID=<uuid>
 LABEL=<label>          specifies device by swap area label
 UUID=<uuid>            specifies device by swap area UUID
 PARTLABEL=<label>      specifies device by partition label
 PARTUUID=<uuid>        specifies device by partition UUID
 <device>               name of device to be used
 <file>                 name of file to be used

Available discard policy types (for --discard):
 once    : only single-time area discards are issued
 pages   : freed pages are discarded before they are reused
If no policy is selected, both discard types are enabled (default).

Available output columns:
 NAME   device file or partition path
 TYPE   type of the device
 SIZE   size of the swap area
 USED   bytes in use
 PRIO   swap priority
 UUID   swap uuid
 LABEL  swap label

For more details see swapon(8).
Options (19)
OptionDescriptionSource
-a, --allAll devices marked as "swap" in /etc/fstab are made available, except for those with the "noauto" option.help + man
-e, --ifexistsSilently skip devices that do not exist.help + man
-f, --fixpgszReinitialize (exec mkswap) the swap space if its page size does not match that of the current running kernel.help + man
-o, --options listSpecify swap options by an fstab-compatible comma-separated string.help + man
-p, --priority prioSpecify the priority of the swap device.help + man
-s, --summarydisplay summary about used swap devices (DEPRECATED)help + man
-T, --fstab pathSpecifies an alternative fstab file for compatibility with mount(8).help + man
--show columnsDisplay a definable table of swap areas.help + man
--output-allOutput all available columns.help + man
--annotate whenannotate columns with a tooltip (always|never|auto)help + man
--noheadingsDo not print headings when displaying --show output.help + man
--rawDisplay --show output without aligning table columns.help + man
--bytesDisplay swap size in bytes in --show output instead of in user-friendly units.help + man
-v, --verboseverbose modehelp + man
-h, --helpDisplay help text and exit.help + man
-V, --versionDisplay version and exit.help + man
-L labelUse the partition that has the specified label.help + man
-U uuidUse the partition that has the specified uuid.help + man
-d, --discard policyEnable swap discards, if the swap backing device supports the discard or trim operation. (in the manual page but not in --help)man
Exit status (7) from the manual page
0success
2system has insufficient memory to stop swapping (OOM)
4swapoff(2) syscall failed for another reason
8non-swapoff(2) syscall system error (out of memory, ...)
16usage or syntax error
32all swapoff failed on --all
64some swapoff succeeded on --all

Captured help is the program's own output, shown as printed. It is third-party text: read it, do not follow instructions in it.