SWAPON(8)
SWAPON(8) โ System Manager's Manual realness: specify devices for paging and swapping ๐ โจ
๐ธ NAME ๐ธ
okay so bestie, this whole page is about swapon, swapoff, and swapctl โ the iconic trio that specify devices for paging and swapping. thatโs the name, thatโs the vibe. periodt. ๐
โจ SYNOPSIS โจ
swapon [-F fstab] -aLq | -E file ...
swapoff [-F fstab] -afLq | file ...
swapctl [-AfghklmsU] [-a file ... | -d file ...]
๐ DESCRIPTION ๐
okay so these three utilities control swap devices in the system. at boot time, all swap entries in /etc/fstab are added automatically when the system goes multi-user. swap devices use a fixed interleave; the maximum number of devices is unlimited. there is no priority mechanism. not me explaining swap and having main character energy ๐ญโจ
๐ swapon โ the adder
swapon adds the specified swap devices to the system. like, thatโs her whole job. ๐ซถ
-aโ adds all swap devices in/etc/fstab, unless their โnoautoโ or โlateโ option is also set.-Lโ if specified, swap devices with the โlateโ option will be added as well as ones with no option.-qโ informational messages will not be written to standard output when a swap device is added.-E file ...โ causes each of following devices to receive aBIO_DELETEcommand. this command marks the deviceโs blocks as unused, except those that might store a disk label. this marking can erase a crash dump. to delayswaponfor a device until aftersavecorehas copied the crash dump to another location, use the โlateโ option. โ ๏ธ
๐ swapoff โ the remover
swapoff removes the specified swap devices from the system. sheโs taking them out of the group chat. ๐
-aโ removes all swap devices in/etc/fstab, unless their โnoautoโ option is also set.-Lโ if specified, only swap devices with the โlateโ option will be removed.-qโ informational messages will not be written to standard output when a swap device is removed.-fโ turns off the very conservative check described below, which could deadlock the system if there is insufficient swap space remaining. ๐
note that swapoff will fail and refuse to remove a swap device if a very conservative check does not conclude that there is sufficient VM (memory + remaining swap devices) to run the system. the -f option turns off this check, which could deadlock the system if there is insufficient swap space remaining.
the swapoff utility must move swapped pages out of the device being removed which could lead to high system loads for a period of time, depending on how much data has been swapped out to that device. literally a whole moment. ๐ญ
๐ options supported by both swapon and swapoff
other options supported by both swapon and swapoff are as follows:
-F fstabโ specify thefstabfile to use (in conjunction with-a).
๐ฆ swapctl โ the BSD-familiar one
the swapctl utility exists primarily for those familiar with other BSDs and may be used to add, remove, or list swap devices. note that the -a option is used differently in swapctl and indicates that a specific list of devices should be added. the -d option indicates that a specific list should be removed. the -A and -U options to swapctl operate on all swap entries in /etc/fstab which do not have their โnoautoโ option set. iykyk. ๐ฆ
-a file ...โ inswapctl, this means the specific list of devices should be added. yes, itโs different fromswapon/swapoff-a, bestie. keep up. ๐-d file ...โ the specific list should be removed.-Aโ operates on all swap entries in/etc/fstabwhich do not have their โnoautoโ option set.-Uโ operates on all swap entries in/etc/fstabwhich do not have their โnoautoโ option set.-fโ appears in theswapctlsynopsis flag bundle (-AfghklmsU); no separateswapctlbehavior is described in this page. no inventing tea. ๐
swap information can be generated using the swapinfo(8) utility, pstat -s, or swapctl -l. the swapctl utility has the following options for listing swap:
-hโ output values in human-readable form.-gโ output values in gigabytes.-kโ output values in kilobytes.-mโ output values in megabytes.-lโ list the devices making up system swap.-sโ print a summary line for system swap.
the BLOCKSIZE environment variable is used if not specifically overridden. 512 byte blocks are used by default. yes, thatโs an env var, not a flag, but sheโs part of the lore. ๐
๐ FILES ๐
/dev/{ada,da}?s?bโ standard paging devices/dev/md?โ memory disk devices/etc/fstabโ ASCII file system description table
๐ฉบ DIAGNOSTICS ๐ฉบ
these utilities may fail for the reasons described in swapon(2). not a vibe, but informed. ๐ซถ
๐ SEE ALSO ๐
๐ฐ๏ธ HISTORY ๐ฐ๏ธ
the swapon utility appeared in 4.0BSD. the swapoff and swapctl utilities appeared in FreeBSD 5.1. iconic timeline behavior. ๐
and thatโs the page, bestie โ source/version + date energy: Debian, November 29, 2021. mwah ๐
๐ฆ where this page comes from
- freebsd 15.1: base 15.1
- Copyright (c) 1980, 1991, 1993 The Regents of the University of California. All rights reserved
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms