swapctl(8) - NetBSD Manual Pages

Command: Section: Arch: Collection:  
SWAPCTL(8)              NetBSD System Manager's Manual              SWAPCTL(8)


NAME
swapctl, swapon - system swap management tool
SYNOPSIS
swapctl -A [-p priority] [-t blk|noblk] swapctl -D dumpdev swapctl -U [-t blk|noblk] swapctl -a [-p priority] path swapctl -c -p priority path swapctl -d path swapctl -l | -s [-k] swapctl -z swapon -a | path
DESCRIPTION
The swapctl program adds, removes, lists and prioritizes swap devices and files for the system. The swapon program acts the same as the swapctl program, as if called with the -a option, except if swapon itself is called with -a in which case, swapon acts as swapctl with the -A option. The following options are available: -A This option causes swapctl to read the /etc/fstab file for de- vices and files with a ``sw'' and ``dp'' type, and adds all these entries as swap devices, or for a dump device in the case of a ``dp'' type. If no swap devices are configured, swapctl will ex- it with an error code. -D The -D option requires that a dumpdev also be in the argument list. The kernel dump device is set to dumpdev. This changed is made via the swapctl(2) system call. The dump device is used when the system crashes to write a current snapshot of real memo- ry, to be saved later with savecore(8) at system reboot, and ana- lyzed to determine the problem. -U This option causes swapctl to read the /etc/fstab file for de- vices and files with a ``sw'' type, and remove all these entries as swap devices. If no swap devices are unconfigured, swapctl will exit with an error code. -a The -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 com- mand, the -a option is treated the same as the -A option, for backwards compatibility. -c The -c option changes the priority of the listed swap device or file. -d The -d option removes the listed path from the kernel's list of swap devices or files. -l The -l option lists the current swap devices and files, and their usage statistics. -s The -s option displays a single line summary of current swap statistics. -p The -p option sets the priority of swap devices or files to the priority argument. This works with the -a, -c and -l options. -k The -k option uses 1024 byte blocks instead of the default 512 byte. -t This flag modifies the function of the -A and -U options. The -t option allows the type of device to add to be specified. An ar- gument 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 avail- able, such as during disk checks of large file systems. -z The -z option displays the current dump device.
SWAP PRIORITY
The NetBSD swap system allows different swap devices and files to be as- signed different priorities, to allow the faster resources to be used first. Swap devices at the same priority are used in a round-robin fash- ion until there is no more space available at this priority, when the next priority level will be used. The default priority is 0, the high- est. This value can be any valid integer, with higher values receiving less priority.
SWAP OPTIONS
When parsing the /etc/fstab file for swap devices, the following options are recognized: priority=N This option sets the priority of the specified swap de- vice to N. nfsmntpt=/path This option is useful for swapping to NFS files. It specifies the local mount point to mount an NFS filesys- tem. 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
SEE ALSO
swapctl(2), fstab(5), mount_nfs(8)
HISTORY
The swapctl program was first made available in NetBSD 1.3. The original swapon program, provided for backwards compatibility, appeared in 4.0BSD.
AUTHORS
The swapctl program was written by Matthew R. Green <mrg@eterna.com.au>.
BUGS
If no swap information is specified in /etc/fstab, the system startup scripts (see rc(8)) will configure no swap space and your machine will behave very badly if (more likely when) it runs out of real memory. Local and remote swap files cannot be configured until after the file systems they reside on are mounted read/write. The system startup scripts need to fsck(8) all local file systems before this can happen. This process requires substantial amounts of memory on some systems. If you configure 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 fsck(8) and may run out of real memo- ry, causing fsck to abnormally exit and startup scripts to fail. NetBSD 1.6 March 5, 2000 2
Powered by man-cgi (2024-03-20). Maintained for NetBSD by Kimmo Suominen. Based on man-cgi by Panagiotis Christias.