1SWAPON(8) Linux Programmer's Manual SWAPON(8)
2
3
4
6 swapon, swapoff - enable/disable devices and files for paging and swap‐
7 ping
8
10 Get info:
11 swapon -s [-h] [-V]
12
13 Enable/disable:
14 swapon [-f] [-p priority] [-v] specialfile...
15 swapoff [-v] specialfile...
16
17 Enable/disable all:
18 swapon -a [-e] [-f] [-v]
19 swapoff -a [-v]
20
22 swapon is used to specify devices on which paging and swapping are to
23 take place.
24
25 The device or file used is given by the specialfile parameter. It may
26 be of the form -L label or -U uuid to indicate a device by label or
27 uuid.
28
29 Calls to swapon normally occur in the system boot scripts making all
30 swap devices available, so that the paging and swapping activity is
31 interleaved across several devices and files.
32
33 swapoff disables swapping on the specified devices and files. When the
34 -a flag is given, swapping is disabled on all known swap devices and
35 files (as found in /proc/swaps or /etc/fstab).
36
37
38 -a, --all
39 All devices marked as ``swap'' in /etc/fstab are made available,
40 except for those with the ``noauto'' option. Devices that are
41 already being used as swap are silently skipped.
42
43 -d, --discard [=policy]
44 Enable swap discards, if the swap backing device supports the
45 discard or trim operation. This may improve performance on some
46 Solid State Devices, but often it does not. The option allows
47 one to select between two available swap discard policies:
48 --discard=once to perform a single-time discard operation for
49 the whole swap area at swapon; or --discard=pages to discard
50 freed swap pages before they are reused, while swapping. If no
51 policy is selected, the default behavior is to enable both dis‐
52 card types. The /etc/fstab mount options discard, discard=once,
53 or discard=pages may be also used to enable discard flags.
54
55 -e, --ifexists
56 Silently skip devices that do not exist.
57
58 -f, --fixpgsz
59 Reinitialize (exec /sbin/mkswap) the swap space if its page size
60 does not match that of the the current running kernel.
61 mkswap(2) initializes the whole device and does not check for
62 bad blocks.
63
64 -h, --help
65 Provide help.
66
67 -L label
68 Use the partition that has the specified label. (For this,
69 access to /proc/partitions is needed.)
70
71 -p, --priority priority
72 Specify the priority of the swap device. priority is a value
73 between 0 and 32767. Higher numbers indicate higher priority.
74 See swapon(2) for a full description of swap priorities. Add
75 pri=value to the option field of /etc/fstab for use with swapon
76 -a.
77
78 -s, --summary
79 Display swap usage summary by device. Equivalent to "cat
80 /proc/swaps". Not available before Linux 2.1.25.
81
82 -U uuid
83 Use the partition that has the specified uuid.
84
85 -v, --verbose
86 Be verbose.
87
88 -V, --version
89 Display version.
90
92 You should not use swapon on a file with holes. Swap over NFS may not
93 work.
94
95 swapon automatically detects and rewrites swap space signature with old
96 software suspend data (e.g S1SUSPEND, S2SUSPEND, ...). The problem is
97 that if we don't do it, then we get data corruption the next time an
98 attempt at unsuspending is made.
99
101 swapon(2), swapoff(2), fstab(5), init(8), mkswap(8), rc(8), mount(8)
102
104 /dev/sd?? standard paging devices
105 /etc/fstab ascii filesystem description table
106
108 The swapon command appeared in 4.0BSD.
109
111 The swapon command is part of the util-linux-ng package and is avail‐
112 able from ftp://ftp.kernel.org/pub/linux/utils/util-linux-ng/.
113
114
115
116Linux 1.x 25 September 1995 SWAPON(8)