xref: /freebsd/sbin/swapon/swapon.8 (revision 7bd6fde3)
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 December 28, 2002
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 AhklsU
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 megabytes.
134.It Fl k
135Output values in kilobytes.
136.It Fl l
137List the devices making up system swap.
138.It Fl s
139Print a summary line for system swap.
140.Pp
141The
142.Ev BLOCKSIZE
143environment variable is used if not specifically
144overridden.
145512 byte blocks are used by default.
146.El
147.Sh FILES
148.Bl -tag -width ".Pa /dev/{ad,da}?s?b" -compact
149.It Pa /dev/{ad,da}?s?b
150standard paging devices
151.It Pa /dev/md?
152memory disk devices
153.It Pa /etc/fstab
154.Tn ASCII
155file system description table
156.El
157.Sh DIAGNOSTICS
158These utilities may fail for the reasons described in
159.Xr swapon 2 .
160.Sh SEE ALSO
161.Xr swapon 2 ,
162.Xr fstab 5 ,
163.Xr init 8 ,
164.Xr mdconfig 8 ,
165.Xr pstat 8 ,
166.Xr rc 8
167.Sh HISTORY
168The
169.Nm swapon
170utility appeared in
171.Bx 4.0 .
172The
173.Nm swapoff
174and
175.Nm swapctl
176utilities appeared in
177.Fx 5.1 .
178