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 June 23, 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 39.Oo Fl F Ar fstab 40.Oc 41.Fl aq | Ar 42.Nm swapoff 43.Oo Fl F Ar fstab 44.Oc 45.Fl aq | Ar 46.Nm swapctl 47.Op Fl AghklmsU 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. 78If the 79.Fl q 80option is used informational messages will not be 81written to standard output when a swap device is added. 82.Pp 83The 84.Nm swapoff 85utility removes the specified swap devices from the system. 86If the 87.Fl a 88option is used, all swap devices in 89.Pa /etc/fstab 90will be removed, unless their 91.Dq noauto 92option is also set. 93If the 94.Fl q 95option is used informational messages will not be 96written to standard output when a swap device is removed. 97Note that 98.Nm swapoff 99will fail and refuse to remove a swap device if there is insufficient 100VM (memory + remaining swap devices) to run the system. 101The 102.Nm swapoff 103utility 104must move swapped pages out of the device being removed which could 105lead to high system loads for a period of time, depending on how 106much data has been swapped out to that device. 107.Pp 108Other options supported by both 109.Nm swapon 110and 111.Nm swapoff 112are as follows: 113.Bl -tag -width indent 114.It Fl F Ar fstab 115Specify the 116.Pa fstab 117file to use. 118.El 119.Pp 120The 121.Nm swapctl 122utility exists primarily for those familiar with other 123.Bx Ns s 124and may be 125used to add, remove, or list swap devices. 126Note that the 127.Fl a 128option is used differently in 129.Nm swapctl 130and indicates that a specific list of devices should be added. 131The 132.Fl d 133option indicates that a specific list should be removed. 134The 135.Fl A 136and 137.Fl U 138options to 139.Nm swapctl 140operate on all swap entries in 141.Pa /etc/fstab 142which do not have their 143.Dq noauto 144option set. 145.Pp 146Swap information can be generated using the 147.Xr swapinfo 8 148utility, 149.Nm pstat 150.Fl s , 151or 152.Nm swapctl 153.Fl l . 154The 155.Nm swapctl 156utility has the following options for listing swap: 157.Bl -tag -width indent 158.It Fl h 159Output values in human-readable form. 160.It Fl g 161Output values in gigabytes. 162.It Fl k 163Output values in kilobytes. 164.It Fl m 165Output values in megabytes. 166.It Fl l 167List the devices making up system swap. 168.It Fl s 169Print a summary line for system swap. 170.Pp 171The 172.Ev BLOCKSIZE 173environment variable is used if not specifically 174overridden. 175512 byte blocks are used by default. 176.El 177.Sh FILES 178.Bl -tag -width ".Pa /dev/{ad,da}?s?b" -compact 179.It Pa /dev/{ad,da}?s?b 180standard paging devices 181.It Pa /dev/md? 182memory disk devices 183.It Pa /etc/fstab 184.Tn ASCII 185file system description table 186.El 187.Sh DIAGNOSTICS 188These utilities may fail for the reasons described in 189.Xr swapon 2 . 190.Sh SEE ALSO 191.Xr swapon 2 , 192.Xr fstab 5 , 193.Xr init 8 , 194.Xr mdconfig 8 , 195.Xr pstat 8 , 196.Xr rc 8 197.Sh HISTORY 198The 199.Nm swapon 200utility appeared in 201.Bx 4.0 . 202The 203.Nm swapoff 204and 205.Nm swapctl 206utilities appeared in 207.Fx 5.1 . 208