]>
Commit | Line | Data |
---|---|---|
6dbe3af9 KZ |
1 | .\" Copyright (c) 1980, 1991 Regents of the University of California. |
2 | .\" All rights reserved. | |
3 | .\" | |
4 | .\" Redistribution and use in source and binary forms, with or without | |
5 | .\" modification, are permitted provided that the following conditions | |
6 | .\" are met: | |
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. | |
19 | .\" | |
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 | |
30 | .\" SUCH DAMAGE. | |
31 | .\" | |
32 | .\" @(#)swapon.8 6.3 (Berkeley) 3/16/91 | |
33 | .\" | |
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 | |
726f69e2 | 38 | .\" Mon Sep 25 14:12:38 1995: Added -v and -p information |
fd6b7a7f | 39 | .\" Tue Apr 30 03:32:07 1996: Added some text from A. Koppenhoefer |
6dbe3af9 | 40 | .\" |
232dc924 | 41 | .TH SWAPON 8 "September 1995" "util-linux" "System Administration" |
6dbe3af9 KZ |
42 | .SH NAME |
43 | swapon, swapoff \- enable/disable devices and files for paging and swapping | |
44 | .SH SYNOPSIS | |
1581e22c | 45 | .B swapon |
7bed68bf KZ |
46 | [ options ] |
47 | .RI [ specialfile... ] | |
fd6b7a7f | 48 | .br |
1581e22c | 49 | .B swapoff |
7bed68bf KZ |
50 | .RB [ \-va ] |
51 | .RI [ specialfile... ] | |
6dbe3af9 | 52 | .SH DESCRIPTION |
ce6479e2 | 53 | .B swapon |
6dbe3af9 | 54 | is used to specify devices on which paging and swapping are to take place. |
756bfd01 KZ |
55 | |
56 | The device or file used is given by the | |
57 | .I specialfile | |
58 | parameter. It may be of the form | |
59 | .BI \-L " label" | |
60 | or | |
61 | .BI \-U " uuid" | |
62 | to indicate a device by label or uuid. | |
63 | ||
6dbe3af9 KZ |
64 | Calls to |
65 | .B swapon | |
1581e22c KZ |
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 | |
68 | files. | |
6dbe3af9 | 69 | |
1581e22c KZ |
70 | .B swapoff |
71 | disables swapping on the specified devices and files. | |
72 | When the | |
6dbe3af9 | 73 | .B \-a |
1581e22c KZ |
74 | flag is given, swapping is disabled on all known swap devices and files |
75 | (as found in | |
76 | .I /proc/swaps | |
77 | or | |
78 | .IR /etc/fstab ). | |
79 | ||
80 | .TP | |
81 | .B "\-a, \-\-all" | |
ce6479e2 | 82 | All devices marked as ``swap'' in |
6dbe3af9 | 83 | .I /etc/fstab |
d162fcb5 | 84 | are made available, except for those with the ``noauto'' option. |
ce6479e2 | 85 | Devices that are already being used as swap are silently skipped. |
c2301380 | 86 | .TP |
d6387c98 RA |
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: | |
92 | .BI \-\-discard=once | |
93 | to perform a single-time discard operation for the whole swap area at swapon; | |
94 | or | |
95 | .BI \-\-discard=pages | |
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. | |
c2301380 HD |
98 | The |
99 | .I /etc/fstab | |
d6387c98 RA |
100 | mount options |
101 | .BI discard, | |
102 | .BI discard=once, | |
103 | or | |
104 | .BI discard=pages | |
105 | may be also used to enable discard flags. | |
302e7b18 | 106 | .TP |
1581e22c | 107 | .B "\-e, \-\-ifexists" |
ce6479e2 | 108 | Silently skip devices that do not exist. |
a5fd3d68 KZ |
109 | The |
110 | .I /etc/fstab | |
111 | mount option | |
112 | .BI nofail | |
113 | may be also used to skip non-existing device. | |
114 | ||
756bfd01 | 115 | .TP |
0d761944 | 116 | .B "\-f, \-\-fixpgsz" |
324a8c4c | 117 | Reinitialize (exec /sbin/mkswap) the swap space if its page size does not |
8d8ea18e | 118 | match that of the current running kernel. |
8323d9fd | 119 | .BR mkswap (2) |
0d761944 KZ |
120 | initializes the whole device and does not check for bad blocks. |
121 | .TP | |
1581e22c | 122 | .B \-h, \-\-help |
ce6479e2 | 123 | Provide help. |
756bfd01 | 124 | .TP |
1581e22c | 125 | .B "\-L \fIlabel\fP" |
756bfd01 KZ |
126 | Use the partition that has the specified |
127 | .IR label . | |
128 | (For this, access to | |
129 | .I /proc/partitions | |
130 | is needed.) | |
726f69e2 | 131 | .TP |
b456d0c7 | 132 | .B "\-p, \-\-priority \fIpriority\fP" |
1581e22c | 133 | Specify the priority of the swap device. |
fd6b7a7f | 134 | .I priority |
9404a96a SK |
135 | is a value between \-1 and 32767. Higher numbers indicate |
136 | higher priority. See | |
fd6b7a7f KZ |
137 | .BR swapon (2) |
138 | for a full description of swap priorities. Add | |
139 | .BI pri= value | |
140 | to the option field of | |
141 | .I /etc/fstab | |
142 | for use with | |
143 | .BR "swapon -a" . | |
9404a96a | 144 | When priority is not defined it defaults to \-1. |
a47f2e66 | 145 | .TP |
1581e22c | 146 | .B "\-s, \-\-summary" |
756bfd01 KZ |
147 | Display swap usage summary by device. Equivalent to "cat /proc/swaps". |
148 | Not available before Linux 2.1.25. | |
149 | .TP | |
7bed68bf | 150 | \fB\-\-show\fR [\fIcolumn\fR, ...] |
e076b552 SK |
151 | Display definable device table similar to |
152 | .B \-\-summary | |
153 | output. See \-\-help output for | |
154 | .I column | |
155 | list. | |
156 | .TP | |
157 | .B \-\-noheadings | |
158 | Do not print headings when displaying | |
159 | .B \-\-show | |
160 | output. | |
161 | .TP | |
162 | .B \-\-raw | |
163 | Display | |
164 | .B \-\-show | |
165 | output without aligning table columns. | |
166 | .TP | |
a68ca3a1 | 167 | .B \-\-bytes |
7ae8b469 SK |
168 | Display swap size in bytes in |
169 | .B \-\-show | |
170 | output instead of user friendly size and unit. | |
1581e22c | 171 | .B "\-U \fIuuid\fP" |
756bfd01 KZ |
172 | Use the partition that has the specified |
173 | .IR uuid . | |
756bfd01 | 174 | .TP |
1581e22c | 175 | .B "\-v, \-\-verbose" |
a47f2e66 | 176 | Be verbose. |
756bfd01 | 177 | .TP |
1581e22c | 178 | .B "\-V, \-\-version" |
ce6479e2 | 179 | Display version. |
1581e22c | 180 | .SH NOTES |
5c36a0eb KZ |
181 | You should not use |
182 | .B swapon | |
183 | on a file with holes. | |
22853e4a | 184 | Swap over NFS may not work. |
1581e22c KZ |
185 | .PP |
186 | .B swapon | |
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 | |
190 | made. | |
26907ffa JM |
191 | .PP |
192 | .B swapon | |
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. | |
202 | ||
ca3dbca1 DB |
203 | .SH ENVIRONMENT |
204 | .IP LIBMOUNT_DEBUG=0xffff | |
205 | enables debug output. | |
206 | ||
6dbe3af9 | 207 | .SH SEE ALSO |
22853e4a KZ |
208 | .BR swapon (2), |
209 | .BR swapoff (2), | |
210 | .BR fstab (5), | |
211 | .BR init (8), | |
212 | .BR mkswap (8), | |
213 | .BR rc (8), | |
214 | .BR mount (8) | |
6dbe3af9 | 215 | .SH FILES |
6dbe3af9 | 216 | .br |
726f69e2 | 217 | .I /dev/sd?? |
1581e22c | 218 | standard paging devices |
6dbe3af9 KZ |
219 | .br |
220 | .I /etc/fstab | |
221 | ascii filesystem description table | |
222 | .SH HISTORY | |
223 | The | |
224 | .B swapon | |
225 | command appeared in 4.0BSD. | |
86d62711 | 226 | .SH AVAILABILITY |
601d12fb KZ |
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/. |