]>
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 | .\" |
726f69e2 | 41 | .TH SWAPON 8 "25 September 1995" "Linux 1.x" "Linux Programmer's Manual" |
6dbe3af9 KZ |
42 | .SH NAME |
43 | swapon, swapoff \- enable/disable devices and files for paging and swapping | |
44 | .SH SYNOPSIS | |
1581e22c | 45 | Get info: |
6dbe3af9 | 46 | .br |
1581e22c KZ |
47 | .in +5 |
48 | .B swapon \-s | |
49 | .RB [ \-h ] | |
50 | .RB [ \-V ] | |
51 | .sp | |
52 | .in -5 | |
53 | Enable/disable: | |
6dbe3af9 | 54 | .br |
1581e22c KZ |
55 | .in +5 |
56 | .B swapon | |
c2301380 | 57 | .RB [ \-d ] |
0d761944 | 58 | .RB [ \-f ] |
1581e22c KZ |
59 | .RB [ \-p |
60 | .IR priority ] | |
61 | .RB [ \-v ] | |
302e7b18 | 62 | .IR specialfile ... |
fd6b7a7f | 63 | .br |
1581e22c KZ |
64 | .B swapoff |
65 | .RB [ \-v ] | |
302e7b18 | 66 | .IR specialfile ... |
1581e22c KZ |
67 | .sp |
68 | .in -5 | |
69 | Enable/disable all: | |
726f69e2 | 70 | .br |
1581e22c KZ |
71 | .in +5 |
72 | .B swapon \-a | |
73 | .RB [ \-e ] | |
0d761944 | 74 | .RB [ \-f ] |
1581e22c | 75 | .RB [ \-v ] |
726f69e2 | 76 | .br |
1581e22c KZ |
77 | .B swapoff \-a |
78 | .RB [ \-v ] | |
79 | .in -5 | |
6dbe3af9 | 80 | .SH DESCRIPTION |
ce6479e2 | 81 | .B swapon |
6dbe3af9 | 82 | is used to specify devices on which paging and swapping are to take place. |
756bfd01 KZ |
83 | |
84 | The device or file used is given by the | |
85 | .I specialfile | |
86 | parameter. It may be of the form | |
87 | .BI \-L " label" | |
88 | or | |
89 | .BI \-U " uuid" | |
90 | to indicate a device by label or uuid. | |
91 | ||
6dbe3af9 KZ |
92 | Calls to |
93 | .B swapon | |
1581e22c KZ |
94 | normally occur in the system boot scripts making all swap devices available, so |
95 | that the paging and swapping activity is interleaved across several devices and | |
96 | files. | |
6dbe3af9 | 97 | |
1581e22c KZ |
98 | .B swapoff |
99 | disables swapping on the specified devices and files. | |
100 | When the | |
6dbe3af9 | 101 | .B \-a |
1581e22c KZ |
102 | flag is given, swapping is disabled on all known swap devices and files |
103 | (as found in | |
104 | .I /proc/swaps | |
105 | or | |
106 | .IR /etc/fstab ). | |
107 | ||
108 | .TP | |
109 | .B "\-a, \-\-all" | |
ce6479e2 | 110 | All devices marked as ``swap'' in |
6dbe3af9 | 111 | .I /etc/fstab |
d162fcb5 | 112 | are made available, except for those with the ``noauto'' option. |
ce6479e2 | 113 | Devices that are already being used as swap are silently skipped. |
c2301380 HD |
114 | .TP |
115 | .B "\-d, \-\-discard" | |
37f243ed KZ |
116 | Discard freed swap pages before they are reused, if the swap |
117 | device supports the discard or trim operation. This may improve | |
118 | performance on some Solid State Devices, but often it does not. | |
c2301380 HD |
119 | The |
120 | .I /etc/fstab | |
121 | mount option | |
122 | .BI discard | |
123 | may be also used to enable discard flag. | |
302e7b18 | 124 | .TP |
1581e22c | 125 | .B "\-e, \-\-ifexists" |
ce6479e2 | 126 | Silently skip devices that do not exist. |
a5fd3d68 KZ |
127 | The |
128 | .I /etc/fstab | |
129 | mount option | |
130 | .BI nofail | |
131 | may be also used to skip non-existing device. | |
132 | ||
756bfd01 | 133 | .TP |
0d761944 | 134 | .B "\-f, \-\-fixpgsz" |
324a8c4c KZ |
135 | Reinitialize (exec /sbin/mkswap) the swap space if its page size does not |
136 | match that of the the current running kernel. | |
0d761944 KZ |
137 | .B mkswap(2) |
138 | initializes the whole device and does not check for bad blocks. | |
139 | .TP | |
1581e22c | 140 | .B \-h, \-\-help |
ce6479e2 | 141 | Provide help. |
756bfd01 | 142 | .TP |
1581e22c | 143 | .B "\-L \fIlabel\fP" |
756bfd01 KZ |
144 | Use the partition that has the specified |
145 | .IR label . | |
146 | (For this, access to | |
147 | .I /proc/partitions | |
148 | is needed.) | |
726f69e2 | 149 | .TP |
b456d0c7 | 150 | .B "\-p, \-\-priority \fIpriority\fP" |
1581e22c | 151 | Specify the priority of the swap device. |
fd6b7a7f | 152 | .I priority |
756bfd01 KZ |
153 | is a value between 0 and 32767. Higher numbers indicate higher |
154 | priority. See | |
fd6b7a7f KZ |
155 | .BR swapon (2) |
156 | for a full description of swap priorities. Add | |
157 | .BI pri= value | |
158 | to the option field of | |
159 | .I /etc/fstab | |
160 | for use with | |
161 | .BR "swapon -a" . | |
a47f2e66 | 162 | .TP |
1581e22c | 163 | .B "\-s, \-\-summary" |
756bfd01 KZ |
164 | Display swap usage summary by device. Equivalent to "cat /proc/swaps". |
165 | Not available before Linux 2.1.25. | |
166 | .TP | |
1581e22c | 167 | .B "\-U \fIuuid\fP" |
756bfd01 KZ |
168 | Use the partition that has the specified |
169 | .IR uuid . | |
756bfd01 | 170 | .TP |
1581e22c | 171 | .B "\-v, \-\-verbose" |
a47f2e66 | 172 | Be verbose. |
756bfd01 | 173 | .TP |
1581e22c | 174 | .B "\-V, \-\-version" |
ce6479e2 | 175 | Display version. |
1581e22c | 176 | .SH NOTES |
5c36a0eb KZ |
177 | You should not use |
178 | .B swapon | |
179 | on a file with holes. | |
22853e4a | 180 | Swap over NFS may not work. |
1581e22c KZ |
181 | .PP |
182 | .B swapon | |
183 | automatically detects and rewrites swap space signature with old software | |
184 | suspend data (e.g S1SUSPEND, S2SUSPEND, ...). The problem is that if we don't | |
185 | do it, then we get data corruption the next time an attempt at unsuspending is | |
186 | made. | |
26907ffa JM |
187 | .PP |
188 | .B swapon | |
189 | may not work correctly when using a swap file with some versions of btrfs. | |
190 | This is due to the swap file implementation in the kernel expecting to be able | |
191 | to write to the file directly, without the assistance of the file system. | |
192 | Since btrfs is a copy-on-write file system, the file location may not be | |
193 | static and corruption can result. Btrfs actively disallows the use of files | |
194 | on its file systems by refusing to map the file. This can be seen in the system | |
195 | log as "swapon: swapfile has holes." One possible workaround is to map the | |
196 | file to a loopback device. This will allow the file system to determine the | |
197 | mapping properly but may come with a performance impact. | |
198 | ||
6dbe3af9 | 199 | .SH SEE ALSO |
22853e4a KZ |
200 | .BR swapon (2), |
201 | .BR swapoff (2), | |
202 | .BR fstab (5), | |
203 | .BR init (8), | |
204 | .BR mkswap (8), | |
205 | .BR rc (8), | |
206 | .BR mount (8) | |
6dbe3af9 | 207 | .SH FILES |
6dbe3af9 | 208 | .br |
726f69e2 | 209 | .I /dev/sd?? |
1581e22c | 210 | standard paging devices |
6dbe3af9 KZ |
211 | .br |
212 | .I /etc/fstab | |
213 | ascii filesystem description table | |
214 | .SH HISTORY | |
215 | The | |
216 | .B swapon | |
217 | command appeared in 4.0BSD. | |
86d62711 KZ |
218 | .SH AVAILABILITY |
219 | The swapon command is part of the util-linux-ng package and is available from | |
220 | ftp://ftp.kernel.org/pub/linux/utils/util-linux-ng/. |