xref: /freebsd/sbin/swapon/swapon.8 (revision 2227a3e9e1a0bcba8481a8067ee8c4b9a96fdda3)
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 April 29, 2008
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 Fl a | Ar
39.Nm swapoff Fl a | Ar
40.Nm swapctl
41.Op Fl AghklmsU
42.Oo
43.Fl a Ar
44|
45.Fl d Ar
46.Oc
47.Sh DESCRIPTION
48The
49.Nm swapon , swapoff
50and
51.Nm swapctl
52utilities are used to control swap devices in the system.
53At boot time all swap entries in
54.Pa /etc/fstab
55are added automatically when the system goes multi-user.
56Swap devices use a fixed interleave; the maximum number of devices
57is specified by the kernel configuration option
58.Dv NSWAPDEV ,
59which is typically set to 4.
60There is no priority mechanism.
61.Pp
62The
63.Nm swapon
64utility adds the specified swap devices to the system.
65If the
66.Fl a
67option is used, all swap devices in
68.Pa /etc/fstab
69will be added, unless their
70.Dq noauto
71option is also set.
72.Pp
73The
74.Nm swapoff
75utility removes the specified swap devices from the system.
76If the
77.Fl a
78option is used, all swap devices in
79.Pa /etc/fstab
80will be removed, unless their
81.Dq noauto
82option is also set.
83Note that
84.Nm swapoff
85will fail and refuse to remove a swap device if there is insufficient
86VM (memory + remaining swap devices) to run the system.
87The
88.Nm swapoff
89utility
90must move swapped pages out of the device being removed which could
91lead to high system loads for a period of time, depending on how
92much data has been swapped out to that device.
93.Pp
94The
95.Nm swapctl
96utility exists primarily for those familiar with other
97.Bx Ns s
98and may be
99used to add, remove, or list swap devices.
100Note that the
101.Fl a
102option is used differently in
103.Nm swapctl
104and indicates that a specific list of devices should be added.
105The
106.Fl d
107option indicates that a specific list should be removed.
108The
109.Fl A
110and
111.Fl U
112options to
113.Nm swapctl
114operate on all swap entries in
115.Pa /etc/fstab
116which do not have their
117.Dq noauto
118option set.
119.Pp
120Swap information can be generated using the
121.Xr swapinfo 8
122utility,
123.Nm pstat
124.Fl s ,
125or
126.Nm swapctl
127.Fl l .
128The
129.Nm swapctl
130utility has the following options for listing swap:
131.Bl -tag -width indent
132.It Fl h
133Output values in human-readable form.
134.It Fl g
135Output values in gigabytes.
136.It Fl k
137Output values in kilobytes.
138.It Fl m
139Output values in megabytes.
140.It Fl l
141List the devices making up system swap.
142.It Fl s
143Print a summary line for system swap.
144.Pp
145The
146.Ev BLOCKSIZE
147environment variable is used if not specifically
148overridden.
149512 byte blocks are used by default.
150.El
151.Sh FILES
152.Bl -tag -width ".Pa /dev/{ad,da}?s?b" -compact
153.It Pa /dev/{ad,da}?s?b
154standard paging devices
155.It Pa /dev/md?
156memory disk devices
157.It Pa /etc/fstab
158.Tn ASCII
159file system description table
160.El
161.Sh DIAGNOSTICS
162These utilities may fail for the reasons described in
163.Xr swapon 2 .
164.Sh SEE ALSO
165.Xr swapon 2 ,
166.Xr fstab 5 ,
167.Xr init 8 ,
168.Xr mdconfig 8 ,
169.Xr pstat 8 ,
170.Xr rc 8
171.Sh HISTORY
172The
173.Nm swapon
174utility appeared in
175.Bx 4.0 .
176The
177.Nm swapoff
178and
179.Nm swapctl
180utilities appeared in
181.Fx 5.1 .
182