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