system swap management tool
program adds, removes, lists and prioritizes
swap devices and files for the system. The
program acts the same as
, except if
itself is called with
, in which case it acts as
The options are as follows:
- This option causes
swapctl to read the
/etc/fstab file for devices and files with an
“sw” type, and adds all these entries as swap devices. If no
swap devices are configured,
swapctl will exit
with an error code.
-a option requires that a
path also be in the argument list. The
path is added to the kernel's list of swap devices
using the swapctl(2)
system call. When using the
swapon form of this
-a option is treated the same as the
-A option, for backwards compatibility.
-c option changes the priority of the listed
swap device or file.
-d option removes the listed
path from the kernel's list of swap devices or
-k option uses 1024 byte blocks instead of the
default 512 byte.
-l option lists the current swap devices and
files, and their usage statistics.
-p option sets the priority of swap devices or
files to the priority argument.
-s option displays a single line summary of
current swap statistics.
- This flag modifies the function of the
-t option allows the type of device to add to
be specified. An argument of
blk causes all block
devices in /etc/fstab to be added. An argument of
noblk causes all non-block devices in
/etc/fstab to be added. This option is useful in
early system startup, where swapping may be needed before all file systems
are available, such as during disk checks of large file systems.
Lines such as the following specify swap devices in
/dev/sd1b none swap sw
d48d0e3fc1c39531.k none swap sw
The initial swap device (root disk, partition b) need not appear
in /etc/fstab, though it is not an error for it to
Additional flags include:
- Swap devices and files may be assigned different priorities, to allow
faster resources to be used first. Swap devices at the same priority are
used in a round-robin fashion until there is no more space available at
this priority, when the next priority level will be used. The default
priority is 0, the highest. This value can be any valid integer, with
higher values receiving less priority.
- This option is useful for swapping to NFS files. It specifies the local
mount point to mount an NFS filesystem. Typically, once this mount has
succeeded, the file to be used for swapping on will be available under
this point mount. For example:
server:/export/swap/client none swap sw,nfsmntpt=/swap
utility exits 0 on success,
and >0 if an error occurs.
program was originally developed in
. It was ported to OpenBSD
by Tobias Weingartner. The original
program, provided for backwards compatibility, appeared in
program was written by
Matthew R. Green
Local and remote swap files cannot be configured until the file systems they
reside on are mounted read/write. The system startup scripts need to
all local file systems
before this can happen. This process requires substantial amounts of memory on
some systems. If one configures no local block swap devices on a machine that
has local file systems to check and rely only on swap files, the machine will
have no swap space at all during system
and may run out of real
memory, causing fsck to abnormally exit and startup scripts to fail.