]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/blob - sbin/swapon/swapon.8
Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.
[FreeBSD/stable/10.git] / sbin / swapon / swapon.8
1 .\" Copyright (c) 1980, 1991, 1993
2 .\"     The Regents of the University of California.  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 .\" 4. Neither the name of the University nor the names of its contributors
13 .\"    may be used to endorse or promote products derived from this software
14 .\"    without specific prior written permission.
15 .\"
16 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 .\" SUCH DAMAGE.
27 .\"
28 .\"     @(#)swapon.8    8.1 (Berkeley) 6/5/93
29 .\" $FreeBSD$
30 .\"
31 .Dd June 21, 2013
32 .Dt SWAPON 8
33 .Os
34 .Sh NAME
35 .Nm swapon , swapoff , swapctl
36 .Nd "specify devices for paging and swapping"
37 .Sh SYNOPSIS
38 .Nm swapon
39 .Oo Fl F Ar fstab
40 .Oc
41 .Fl aLq | Ar
42 .Nm swapoff
43 .Oo Fl F Ar fstab
44 .Oc
45 .Fl aLq | Ar
46 .Nm swapctl
47 .Op Fl AghklmsU
48 .Oo
49 .Fl a Ar
50 |
51 .Fl d Ar
52 .Oc
53 .Sh DESCRIPTION
54 The
55 .Nm swapon , swapoff
56 and
57 .Nm swapctl
58 utilities are used to control swap devices in the system.
59 At boot time all swap entries in
60 .Pa /etc/fstab
61 are added automatically when the system goes multi-user.
62 Swap devices use a fixed interleave; the maximum number of devices
63 is specified by the kernel configuration option
64 .Dv NSWAPDEV ,
65 which is typically set to 4.
66 There is no priority mechanism.
67 .Pp
68 The
69 .Nm swapon
70 utility adds the specified swap devices to the system.
71 If the
72 .Fl a
73 option is used, all swap devices in
74 .Pa /etc/fstab
75 will be added, unless their
76 .Dq noauto
77 or
78 .Dq late
79 option is also set.
80 If the
81 .Fl L
82 option is specified,
83 swap devices with the
84 .Dq late
85 option will be added as well as ones with no option.
86 If the
87 .Fl q
88 option is used,
89 informational messages will not be
90 written to standard output when a swap device is added.
91 .Pp
92 The
93 .Nm swapoff
94 utility removes the specified swap devices from the system.
95 If the
96 .Fl a
97 option is used, all swap devices in
98 .Pa /etc/fstab
99 will be removed, unless their
100 .Dq noauto
101 or
102 .Dq late
103 option is also set.
104 If the
105 .Fl L
106 option is specified,
107 swap devices with the
108 .Dq late
109 option will be removed as well as ones with no option.
110 If the
111 .Fl q
112 option is used,
113 informational messages will not be
114 written to standard output when a swap device is removed.
115 Note that
116 .Nm swapoff
117 will fail and refuse to remove a swap device if there is insufficient
118 VM (memory + remaining swap devices) to run the system.
119 The
120 .Nm swapoff
121 utility
122 must move swapped pages out of the device being removed which could
123 lead to high system loads for a period of time, depending on how
124 much data has been swapped out to that device.
125 .Pp
126 Other options supported by both
127 .Nm swapon
128 and
129 .Nm swapoff
130 are as follows:
131 .Bl -tag -width indent
132 .It Fl F Ar fstab
133 Specify the
134 .Pa fstab
135 file to use.
136 .El
137 .Pp
138 The
139 .Nm swapctl
140 utility exists primarily for those familiar with other
141 .Bx Ns s
142 and may be
143 used to add, remove, or list swap devices.
144 Note that the
145 .Fl a
146 option is used differently in
147 .Nm swapctl
148 and indicates that a specific list of devices should be added.
149 The
150 .Fl d
151 option indicates that a specific list should be removed.
152 The
153 .Fl A
154 and
155 .Fl U
156 options to
157 .Nm swapctl
158 operate on all swap entries in
159 .Pa /etc/fstab
160 which do not have their
161 .Dq noauto
162 option set.
163 .Pp
164 Swap information can be generated using the
165 .Xr swapinfo 8
166 utility,
167 .Nm pstat
168 .Fl s ,
169 or
170 .Nm swapctl
171 .Fl l .
172 The
173 .Nm swapctl
174 utility has the following options for listing swap:
175 .Bl -tag -width indent
176 .It Fl h
177 Output values in human-readable form.
178 .It Fl g
179 Output values in gigabytes.
180 .It Fl k
181 Output values in kilobytes.
182 .It Fl m
183 Output values in megabytes.
184 .It Fl l
185 List the devices making up system swap.
186 .It Fl s
187 Print a summary line for system swap.
188 .Pp
189 The
190 .Ev BLOCKSIZE
191 environment variable is used if not specifically
192 overridden.
193 512 byte blocks are used by default.
194 .El
195 .Sh FILES
196 .Bl -tag -width ".Pa /dev/{ad,da}?s?b" -compact
197 .It Pa /dev/{ad,da}?s?b
198 standard paging devices
199 .It Pa /dev/md?
200 memory disk devices
201 .It Pa /etc/fstab
202 .Tn ASCII
203 file system description table
204 .El
205 .Sh DIAGNOSTICS
206 These utilities may fail for the reasons described in
207 .Xr swapon 2 .
208 .Sh SEE ALSO
209 .Xr swapon 2 ,
210 .Xr fstab 5 ,
211 .Xr init 8 ,
212 .Xr mdconfig 8 ,
213 .Xr pstat 8 ,
214 .Xr rc 8
215 .Sh HISTORY
216 The
217 .Nm swapon
218 utility appeared in
219 .Bx 4.0 .
220 The
221 .Nm swapoff
222 and
223 .Nm swapctl
224 utilities appeared in
225 .Fx 5.1 .