xref: /freebsd/sbin/swapon/swapon.8 (revision 8d20be1e22095c27faf8fe8b2f0d089739cc742e)
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
54The
55.Nm swapon , swapoff
56and
57.Nm swapctl
58utilities are used to control swap devices in the system.
59At boot time all swap entries in
60.Pa /etc/fstab
61are added automatically when the system goes multi-user.
62Swap devices use a fixed interleave; the maximum number of devices
63is specified by the kernel configuration option
64.Dv NSWAPDEV ,
65which is typically set to 4.
66There is no priority mechanism.
67.Pp
68The
69.Nm swapon
70utility adds the specified swap devices to the system.
71If the
72.Fl a
73option is used, all swap devices in
74.Pa /etc/fstab
75will be added, unless their
76.Dq noauto
77or
78.Dq late
79option is also set.
80If the
81.Fl L
82option is specified,
83swap devices with the
84.Dq late
85option will be added as well as ones with no option.
86If the
87.Fl q
88option is used,
89informational messages will not be
90written to standard output when a swap device is added.
91.Pp
92The
93.Nm swapoff
94utility removes the specified swap devices from the system.
95If the
96.Fl a
97option is used, all swap devices in
98.Pa /etc/fstab
99will be removed, unless their
100.Dq noauto
101or
102.Dq late
103option is also set.
104If the
105.Fl L
106option is specified,
107swap devices with the
108.Dq late
109option will be removed as well as ones with no option.
110If the
111.Fl q
112option is used,
113informational messages will not be
114written to standard output when a swap device is removed.
115Note that
116.Nm swapoff
117will fail and refuse to remove a swap device if there is insufficient
118VM (memory + remaining swap devices) to run the system.
119The
120.Nm swapoff
121utility
122must move swapped pages out of the device being removed which could
123lead to high system loads for a period of time, depending on how
124much data has been swapped out to that device.
125.Pp
126Other options supported by both
127.Nm swapon
128and
129.Nm swapoff
130are as follows:
131.Bl -tag -width indent
132.It Fl F Ar fstab
133Specify the
134.Pa fstab
135file to use.
136.El
137.Pp
138The
139.Nm swapctl
140utility exists primarily for those familiar with other
141.Bx Ns s
142and may be
143used to add, remove, or list swap devices.
144Note that the
145.Fl a
146option is used differently in
147.Nm swapctl
148and indicates that a specific list of devices should be added.
149The
150.Fl d
151option indicates that a specific list should be removed.
152The
153.Fl A
154and
155.Fl U
156options to
157.Nm swapctl
158operate on all swap entries in
159.Pa /etc/fstab
160which do not have their
161.Dq noauto
162option set.
163.Pp
164Swap information can be generated using the
165.Xr swapinfo 8
166utility,
167.Nm pstat
168.Fl s ,
169or
170.Nm swapctl
171.Fl l .
172The
173.Nm swapctl
174utility has the following options for listing swap:
175.Bl -tag -width indent
176.It Fl h
177Output values in human-readable form.
178.It Fl g
179Output values in gigabytes.
180.It Fl k
181Output values in kilobytes.
182.It Fl m
183Output values in megabytes.
184.It Fl l
185List the devices making up system swap.
186.It Fl s
187Print a summary line for system swap.
188.Pp
189The
190.Ev BLOCKSIZE
191environment variable is used if not specifically
192overridden.
193512 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
198standard paging devices
199.It Pa /dev/md?
200memory disk devices
201.It Pa /etc/fstab
202.Tn ASCII
203file system description table
204.El
205.Sh DIAGNOSTICS
206These 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
216The
217.Nm swapon
218utility appeared in
219.Bx 4.0 .
220The
221.Nm swapoff
222and
223.Nm swapctl
224utilities appeared in
225.Fx 5.1 .
226