1 .\" Copyright (c) 1980, 1991 Regents of the University of California.
2 .\" All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\" notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\" notice, this list of conditions and the following disclaimer in the
11 .\" documentation and/or other materials provided with the distribution.
12 .\" 3. All advertising materials mentioning features or use of this software
13 .\" must display the following acknowledgement:
14 .\" This product includes software developed by the University of
15 .\" California, Berkeley and its contributors.
16 .\" 4. Neither the name of the University nor the names of its contributors
17 .\" may be used to endorse or promote products derived from this software
18 .\" without specific prior written permission.
20 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 .\" @(#)swapon.8 6.3 (Berkeley) 3/16/91
34 .\" Sun Dec 27 12:31:30 1992: Modified by faith@cs.unc.edu
35 .\" Sat Mar 6 20:46:02 1993: Modified by faith@cs.unc.edu
36 .\" Sat Oct 9 09:35:30 1993: Converted to man format by faith@cs.unc.edu
37 .\" Sat Nov 27 20:22:42 1993: Updated authorship information, faith@cs.unc.edu
38 .\" Mon Sep 25 14:12:38 1995: Added -v and -p information
39 .\" Tue Apr 30 03:32:07 1996: Added some text from A. Koppenhoefer
41 .TH SWAPON 8 "September 1995" "util-linux" "System Administration"
43 swapon, swapoff \- enable/disable devices and files for paging and swapping
47 .RI [ specialfile... ]
51 .RI [ specialfile... ]
54 is used to specify devices on which paging and swapping are to take place.
56 The device or file used is given by the
58 parameter. It may be of the form
62 to indicate a device by label or uuid.
66 normally occur in the system boot scripts making all swap devices available, so
67 that the paging and swapping activity is interleaved across several devices and
71 disables swapping on the specified devices and files.
74 flag is given, swapping is disabled on all known swap devices and files
82 All devices marked as ``swap'' in
84 are made available, except for those with the ``noauto'' option.
85 Devices that are already being used as swap are silently skipped.
87 .B "\-d, \-\-discard\fR [=\fIpolicy\fR]"
88 Enable swap discards, if the swap backing device supports the discard or
89 trim operation. This may improve performance on some Solid State Devices,
90 but often it does not. The option allows one to select between two
91 available swap discard policies:
93 to perform a single-time discard operation for the whole swap area at swapon;
96 to discard freed swap pages before they are reused, while swapping.
97 If no policy is selected, the default behavior is to enable both discard types.
105 may be also used to enable discard flags.
107 .B "\-e, \-\-ifexists"
108 Silently skip devices that do not exist.
113 may be also used to skip non-existing device.
116 .B "\-f, \-\-fixpgsz"
117 Reinitialize (exec /sbin/mkswap) the swap space if its page size does not
118 match that of the current running kernel.
120 initializes the whole device and does not check for bad blocks.
123 Display help text and exit.
126 Use the partition that has the specified
132 .B "\-p, \-\-priority \fIpriority\fP"
133 Specify the priority of the swap device.
135 is a value between \-1 and 32767. Higher numbers indicate
138 for a full description of swap priorities. Add
140 to the option field of
144 When priority is not defined it defaults to \-1.
146 .B "\-s, \-\-summary"
147 Display swap usage summary by device. Equivalent to "cat /proc/swaps".
148 Not available before Linux 2.1.25.
150 \fB\-\-show\fR [\fIcolumn\fR, ...]
151 Display definable device table similar to
153 output. See \-\-help output for
158 Do not print headings when displaying
165 output without aligning table columns.
168 Display swap size in bytes in
170 output instead of user friendly size and unit.
172 Use the partition that has the specified
175 .B "\-v, \-\-verbose"
178 .B "\-V, \-\-version"
179 Display version information and exit.
183 on a file with holes.
184 Swap over NFS may not work.
187 automatically detects and rewrites swap space signature with old software
188 suspend data (e.g S1SUSPEND, S2SUSPEND, ...). The problem is that if we don't
189 do it, then we get data corruption the next time an attempt at unsuspending is
193 may not work correctly when using a swap file with some versions of btrfs.
194 This is due to the swap file implementation in the kernel expecting to be able
195 to write to the file directly, without the assistance of the file system.
196 Since btrfs is a copy-on-write file system, the file location may not be
197 static and corruption can result. Btrfs actively disallows the use of files
198 on its file systems by refusing to map the file. This can be seen in the system
199 log as "swapon: swapfile has holes." One possible workaround is to map the
200 file to a loopback device. This will allow the file system to determine the
201 mapping properly but may come with a performance impact.
204 .IP LIBMOUNT_DEBUG=0xffff
205 enables debug output.
218 standard paging devices
221 ascii filesystem description table
225 command appeared in 4.0BSD.
227 The swapon command is part of the util-linux package and is available from
228 ftp://ftp.kernel.org/pub/linux/utils/util-linux/.