xref: /freebsd/sbin/swapon/swapon.8 (revision 4b2eaea43fec8e8792be611dea204071a10b655a)
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 June 5, 1993
36.Dt SWAPON 8
37.Os
38.Sh NAME
39.Nm swapon , swapoff
40.Nd "specify devices for paging and swapping"
41.Sh SYNOPSIS
42.Nm swap[on|off]
43.Fl a
44.Nm swap[on|off]
45.Ar special_file ...
46.Nm swapctl
47.Fl lshk
48.Nm swapctl
49.Fl AU
50.Nm swapctl
51.Fl a
52.Ar special_file ...
53.Nm swapctl
54.Fl d
55.Ar special_file ...
56.Sh DESCRIPTION
57The
58.Nm swap[on,off,ctl]
59utilties are used to control swap devices in the system.  At boot time all
60swap entries in
61.Pa /etc/fstab
62are added automatically when the system goes multi-user.
63Swap devices are interleaved and kernels are typically configured
64to handle a maximum of 4 swap devices.  There is no priority mechanism.
65.Pp
66The
67.Nm swapon
68utility adds the specified swap devices to the system.  If the
69.Fl a
70option is used, all swap devices in
71.Pa /etc/fstab
72will be added, unless their ``noauto'' option is also set.
73.Pp
74The
75.Nm swapoff
76utility removes the specified swap devices from the system.  If the
77.Fl a
78option is used, all swap devices in
79.Pa /etc/fstab
80will be removed, unless their ``noauto'' option is also set.
81Note that
82.Nm swapoff
83will fail and refuse to remove a swap device if there is insufficient
84VM (memory + remaining swap devices) to run the system.
85.Nm Swapoff
86must move swapped pages out of the device being removed which could
87lead to high system loads for a period of time, depending on how
88much data has been swapped out to that device.
89.Pp
90The
91.Nm swapctl
92utility exists primarily for those familiar with other BSDs and may be
93used to add, remove, or list swap.  Note that the
94.Fl a
95option is used diferently in
96.Nm swapctl
97and indicates that a specific list of devices should be added.
98The
99.Fl d
100option indicates that a specific list should be removed.  The
101.Fl A
102and
103.Fl D
104options to
105.Nm swapctl
106operate on all swap entries in
107.Pa /etc/fstab
108which do not have their ``noauto'' option set.
109.Pp
110Swap information can be generated using the
111.Nm swapinfo
112program,
113.Nm pstat
114.Fl s ,
115or
116.Nm swapctl
117.Fl lshk .
118The
119.Nm swapctl
120utility has the following options for listing swap:
121.Bl -tag -width indent
122.It Fl l
123List the devices making up system swap.
124.It Fl s
125Print a summary line for system swap.
126.It Fl h
127Output values in megabytes.
128.It Fl k
129Output values in kilobytes.
130.Pp
131The BLOCKSIZE environment variable is used if not specifically
132overridden.  512 byte blocks are used by default.
133.El
134.Sh SEE ALSO
135.Xr swapon 2 ,
136.Xr fstab 5 ,
137.Xr init 8 ,
138.Xr mdconfig 8 ,
139.Xr pstat 8 ,
140.Xr rc 8
141.Sh FILES
142.Bl -tag -width "/dev/{ad,da}?s?b" -compact
143.It Pa /dev/{ad,da}?s?b
144standard paging devices
145.It Pa /dev/md?
146memory disk devices
147.It Pa /etc/fstab
148ASCII file system description table
149.El
150.Sh HISTORY
151The
152.Nm swapon
153utility appeared in
154.Bx 4.0 .
155The
156.Nm swapoff
157utility appeared in
158.Fx 5.0 .
159