xref: /freebsd/sbin/swapon/swapon.8 (revision 81d1ffee089aab2652954909acbe6aadd8a1a72c)
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.\" 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	8.1 (Berkeley) 6/5/93
33.\" $FreeBSD$
34.\"
35.Dd December 28, 2002
36.Dt SWAPON 8
37.Os
38.Sh NAME
39.Nm swapon , swapoff , swapctl
40.Nd "specify devices for paging and swapping"
41.Sh SYNOPSIS
42.Nm swapon Ar
43.Nm swapon Fl a
44.Nm swapoff Ar
45.Nm swapoff Fl a
46.Nm swapctl
47.Op Fl AhklsU
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
77option is also set.
78.Pp
79The
80.Nm swapoff
81utility removes the specified swap devices from the system.
82If the
83.Fl a
84option is used, all swap devices in
85.Pa /etc/fstab
86will be removed, unless their
87.Dq noauto
88option is also set.
89Note that
90.Nm swapoff
91will fail and refuse to remove a swap device if there is insufficient
92VM (memory + remaining swap devices) to run the system.
93The
94.Nm swapoff
95utility
96must move swapped pages out of the device being removed which could
97lead to high system loads for a period of time, depending on how
98much data has been swapped out to that device.
99.Pp
100The
101.Nm swapctl
102utility exists primarily for those familiar with other
103.Bx Ns s
104and may be
105used to add, remove, or list swap devices.
106Note that the
107.Fl a
108option is used differently in
109.Nm swapctl
110and indicates that a specific list of devices should be added.
111The
112.Fl d
113option indicates that a specific list should be removed.
114The
115.Fl A
116and
117.Fl U
118options to
119.Nm swapctl
120operate on all swap entries in
121.Pa /etc/fstab
122which do not have their
123.Dq noauto
124option set.
125.Pp
126Swap information can be generated using the
127.Xr swapinfo 8
128utility,
129.Nm pstat
130.Fl s ,
131or
132.Nm swapctl
133.Fl l .
134The
135.Nm swapctl
136utility has the following options for listing swap:
137.Bl -tag -width indent
138.It Fl h
139Output values in megabytes.
140.It Fl k
141Output values in kilobytes.
142.It Fl l
143List the devices making up system swap.
144.It Fl s
145Print a summary line for system swap.
146.Pp
147The
148.Ev BLOCKSIZE
149environment variable is used if not specifically
150overridden.
151512 byte blocks are used by default.
152.El
153.Sh DIAGNOSTICS
154These utilities may fail for the reasons described in
155.Xr swapon 2 .
156.Sh SEE ALSO
157.Xr swapon 2 ,
158.Xr fstab 5 ,
159.Xr init 8 ,
160.Xr mdconfig 8 ,
161.Xr pstat 8 ,
162.Xr rc 8
163.Sh FILES
164.Bl -tag -width ".Pa /dev/{ad,da}?s?b" -compact
165.It Pa /dev/{ad,da}?s?b
166standard paging devices
167.It Pa /dev/md?
168memory disk devices
169.It Pa /etc/fstab
170.Tn ASCII
171file system description table
172.El
173.Sh HISTORY
174The
175.Nm swapon
176utility appeared in
177.Bx 4.0 .
178The
179.Nm swapoff
180and
181.Nm swapctl
182utilities appeared in
183.Fx 5.1 .
184