1SWAPON(8)                    System Administration                   SWAPON(8)
2
3
4

NAME

6       swapon, swapoff - enable/disable devices and files for paging and swap‐
7       ping
8

SYNOPSIS

10       swapon [options] [specialfile...]
11       swapoff [-va] [specialfile...]
12

DESCRIPTION

14       swapon is used to specify devices on which paging and swapping  are  to
15       take place.
16
17       The  device or file used is given by the specialfile parameter.  It may
18       be of the form -L label or -U uuid to indicate a  device  by  label  or
19       uuid.
20
21       Calls  to  swapon  normally occur in the system boot scripts making all
22       swap devices available, so that the paging  and  swapping  activity  is
23       interleaved across several devices and files.
24
25       swapoff disables swapping on the specified devices and files.  When the
26       -a flag is given, swapping is disabled on all known  swap  devices  and
27       files (as found in /proc/swaps or /etc/fstab).
28
29

OPTIONS

31       -a, --all
32              All devices marked as ``swap'' in /etc/fstab are made available,
33              except for those with the ``noauto'' option.  Devices  that  are
34              already being used as swap are silently skipped.
35
36       -d, --discard[=policy]
37              Enable  swap  discards,  if the swap backing device supports the
38              discard or trim operation.  This may improve performance on some
39              Solid  State  Devices, but often it does not.  The option allows
40              one to select  between  two  available  swap  discard  policies:
41              --discard=once  to  perform  a single-time discard operation for
42              the whole swap area  at  swapon;  or  --discard=pages  to  asyn‐
43              chronously  discard  freed  swap pages before they are available
44              for reuse.  If no policy is selected, the default behavior is to
45              enable  both  discard  types.  The /etc/fstab mount options dis‐
46              card, discard=once, or discard=pages may also be used to  enable
47              discard flags.
48
49       -e, --ifexists
50              Silently  skip  devices that do not exist.  The /etc/fstab mount
51              option nofail may also be used to skip non-existing device.
52
53
54       -f, --fixpgsz
55              Reinitialize (exec mkswap) the swap space if its page size  does
56              not  match  that  of the current running kernel.  mkswap(2) ini‐
57              tializes the whole device and does not check for bad blocks.
58
59       -h, --help
60              Display help text and exit.
61
62       -L label
63              Use the partition that has  the  specified  label.   (For  this,
64              access to /proc/partitions is needed.)
65
66       -o, --options opts
67              Specify  swap  options  by  an  fstab-compatible comma-separated
68              string.  For example:
69
70                     swapon -o pri=1,discard=pages,nofail /dev/sda2
71
72              The opts string is evaluated last and overrides all  other  com‐
73              mand line options.
74