Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

swapon(2)

swapon(8)  —  Maintenance

OSF

NAME

swapon − Specifies additional file for paging and swapping

SYNOPSIS

/sbin/swapon [-av] [-p priority] [-l lowsize] [-h highsize] [-c clustersize] filename

DESCRIPTION

The swapon command is used to specify additional paging files. A paging file can be a file on the system or a raw device.  Calls to swapon normally occur in the system multiuser state initialization.  When specified, the -v option generates verbose output. 

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 unavailable 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 may 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.  If the swapon command is called without the -p flag, the command uses a priority default of 4 for raw devices, and 3 for regular files. 

The -l option 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 operating 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. 

The -c flag specifies the cluster size that is used for the paging file. A cluster size is the number of pages that the kernel will page in or page out to a file at a time. Cluster size must be a power of 2.  The maximum clustersize is 8.  Please note that once you have set the first paging file’s cluster size, it becomes the cluster size for all subsequently created paging files. 

It is possible to specify the following swapon options in the /etc/fstab file:

sw,pri=nclsize=n,lowater=n,hiwater=n

where n is a number. 

For example, the following entry in the fstab file results in the file /paging/space being added as a paging file of priority 2 by swapon -a:

/paging/space paging xxx sw,pri=2 0 0

Command line options of the swapon command override those set in the fstab file. 

FLAGS

-aInstalls all paging files specified in the /etc/fstab file. 

-vGenerates verbose output. 

-p priorityThe priority of the specified paging file. 

-l lowsizeThe low water mark. 

-h highsizeThe high water mark. 

-c clustersizeThe cluster size of the specified paging file. 

EXAMPLES

     1.To add the /paging/swapon file to the paging list, enter:

swapon /paging/swapon

     2.To add the /paging/swapon2 file to the paging list and specify a low water mark of 16Mbytes and a high water mark of 64Mbytes, enter:

swapon -l 16M -h 64M /paging/swapon2

NOTES

There is no way to stop paging and swapping on a file. It is therefore not possible to make use of files which may be dismounted during system operation. 

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. 

FILES

/sbin/swapon
Specifies the command path

RELATED INFORMATION

Functions: swapon(2)

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026