Manual Page Result
0
Command: swapon | Section: 8 | Source: Digital UNIX | File: swapon.8.gz
swapon(8) System Manager's Manual swapon(8)
NAME
swapon - Specifies additional file for paging and swapping
SYNOPSIS
/sbin/swapon [-asv] [-p priority] [-l lowsize] [-h highsize] filename
DESCRIPTION
The swapon command is used to specify additional paging files. A paging
file can be a block special device. (Digital UNIX does not currently
support paging and swapping to a regular file. All swapping and paging
areas must be block special devices.) The swapon command uses a prior-
ity default of 4 for block special devices. Calls to swapon normally
occur in the system multiuser state initialization.
When you make more swap space available with the command, the addi-
tional swap space is available until the system is rebooted. To make
additional swap space permanent, you must specify the swap file entry
in the /etc/fstab file.
The swapon command flags can override the partition specifications in
the /etc/fstab file.
(Because Digital UNIX does not currently support paging and swapping to
a regular file, the -p option is not supported.) The -p flag specifies
the priority of the paging file. When the kernel looks for a paging
file, it pages to the highest priority file that is available. If the
file is unavailable, it tries a file of the next highest priority, and
so on until it finds a file onto which it can page. (A file becomes un-
available when it has no more space.) Priorities are 0, 1, 2, 3, 4,
with 0 being lowest priority, and 4 being highest priority. Multiple
paging files can have the same priority. For example, there can be two
files installed at priority 4. Files of the same priority are paged out
to in a round-robin fashion to balance their usage.
(Because Digital UNIX does not currently support paging and swapping to
a regular file, the -l and -h options are not supported.) The -l op-
tion is used to specify the low water mark. Normally, the -a option is
used, causing all files marked as sw (swap files) in the /etc/fstab
file to be made available. The -h option is used to specify the high
water mark. The operating system will not expand the paging file to be
larger than the high water mark. If the paging file grows larger than
the low water mark, and then shrinks below the low water mark, the op-
erating system will not make the file smaller than the low water mark.
If the low water mark is set to 0, then the paging file will not shrink
after paging space is freed. The default value for the low water mark
is 20Mbytes; the default value for the high water mark is unlimited.
You can use Logical Storage Manager (LSM) volumes for additional swap
space. For high system availability, you can mirror the LSM volumes.
The Logical Storage Manager manual describes how to use the command to
configure an LSM mirrored volume as additional swap space.
There are two strategies for swap space allocation: immediate mode and
deferred or over-commitment mode. The two strategies differ in the
point in time at which swap space is allocated. If immediate mode is
used, swap space is allocated when modifiable virtual address space is
created. If deferred mode is used, swap space is not allocated until
the system needs to write a modified virtual page to swap space. Imme-
diate mode is the default swap space allocation strategy.
Immediate mode is more conservative than deferred mode because each
modifiable virtual page is assigned a page of swap space when it is
created. If you use the immediate mode of swap space allocation, you
must allocate a swap space that is at least as large as the total
amount of modifiable virtual address space that will be created on your
system. Immediate mode requires significantly more swap space than de-
ferred mode because it guarantees that there will be enough swap space
if every modifiable virtual page is modified.
If you use the deferred mode of swap space allocation, you must esti-
mate the total amount of virtual address space that will be both cre-
ated and modified, and compare that total amount with the size of your
system's physical memory. If this total amount is greater than the
size of physical memory, the swap space must be large enough to hold
the modified virtual pages that do not fit into your physical memory.
If your system's workload is complex and you are unable to estimate the
appropriate amount of swap space by using this mode, you should first
use the default amount of swap space and adjust the swap space as
needed.
To determine which swap space allocation mode is being used, check for
the existence of a soft link named /sbin/swapdefault, which points to
the primary swap partition. If the /sbin/swapdefault file exists, the
system uses the immediate mode for swap space allocation. To enable
the deferred mode, rename or delete this soft link.
If the /sbin/swapdefault file does not exist and you want to use the
immediate mode of swap space allocation, become superuser and create
the file by using the following command syntax:
ln -s /dev/rzxy /sbin/swapdefault
The x variable specifies the device number for the device that holds
the primary swap partition, and the y variable specifies the swap par-
tition. Usually, the swap device number is the same as the boot device
number, and the primary swap partition is partition b.
You must reboot the system for the new mode to take effect.
FLAGS
Installs all paging files specified in the /etc/fstab file. The high
water mark. Currently not supported. The low water mark. Currently
not supported. The priority of the specified paging file. Currently
not supported. Displays swap space utilization. For each swap parti-
tion, this flag displays the total amount of allocated swap space, the
amount of swap space that is being used, and the amount of free swap
space. Generates verbose output.
NOTES
There is no way to stop paging and swapping on a file. It is therefore
not possible to use swap files that can be dismounted during system op-
eration.
The new -p flag replaces earlier versions of the -p flag, which caused
the swapon command to designate the paging file as a preferred paging
file.
EXAMPLES
The following example shows a swap file entry in an /etc/fstab file:
/dev/rz0b swap2 ufs sw 0 0
The following command adds the /dev/rz0b block device file as swap
space: swapon /dev/rz0b
ERRORS
You may receive the following messages when using the swapon command:
special-device or an overlapping partition is open. Quitting...
This message indicates that you tried to add a partition as a
swap device that is actively in use by UFS, AdvFS, swap, or LSM.
special-device is marked in use for fstype in the disklabel. If
you continue with the operation you can possibly destroy exist-
ing data. CONTINUE? [y/n]
This message indicates that you tried to use a partition as a
swap device that is not currently in active use but is marked
for use in the disk label's partition map. For example, the
partition may be part of an LSM volume or an AdvFS domain.
If you know that the partition you specified to swapon does not
contain any data, you can choose to override the warning. In
this case, the fstype in the disk label will be modified to
swap.
Note that you can use the disklabel -s command to set the fstype
in the disk label to unused for partitions that do not contain
any valid data. See disklabel(8) for more information. Parti-
tion(s) which overlap special-device are marked in use. If you
continue with the operation you can possibly destroy existing
data. CONTINUE? [y/n]
This message indicates that the partition you specified is not
marked for use, but other, overlapping partitions on the disk
are marked for use. If you override this warning, the fstype in
the disk's label will be modified. The partition you specified
to swapon will be marked as in use as a swap device and all
overlapping partition will be marked UNUSED.
The following examples illustrate these messages: Adding a partition
that is marked for use as a swap device: # /usr/sbin/swapon /dev/rz11g
/dev/rz11g disk is marked in use for LSMpubl in the disklabel. If you
continue with the operation you can possibly destroy existing data.
CONTINUE? [y/n] Partition g of disk rz11 is part of a disk marked for
use by LSM. If LSM is not actively using this partition and the parti-
tion does not contain any data, you may want to override this warning,
by answering y. In this case, partition g will be marked as swap in
the disk label. Adding a partition as a swap device whose overlapping
partitions are marked for use: # /usr/sbin/swapon /dev/rz11c
Partition(s) which overlap /dev/rz11c are marked in use. If you con-
tinue with the operation you can possibly destroy existing data. CON-
TINUE? [y/n] If you answer yes, partition c on disk rz11 will be marked
swap in the disk label and all partitions that overlap c will be marked
UNUSED. Adding a partition which is currently in use as a swap device:
# /usr/sbin/swapon /dev/rz11g
/dev/rz11g or an overlapping partition is open. Quitting... Adding a
partition which does not have a disk label as a swap device: #
/usr/sbin/swapon /dev/rz11c
The disklabel for /dev/rz11c does not exist or is corrupted. Quit-
ting... See disklabel(8) for information on installing a disk label on
a disk.
FILES
Specifies the command path Specifies information about file systems and
swap files. Specifies the primary swap partition and indicates that
the immediate mode of swap space allocation is being used.
RELATED INFORMATION
Functions: swapon(2)
System Administration delim off
swapon(8)