swap -- administer swap space


/etc/swap -a swapdev [ [ swaplo ] swaplen ]

/etc/swap -d swapdev [ swaplo ]

/etc/swap -l


The swap command provides a method of adding, deleting, and monitoring the system swap areas used by the memory manager. (A swap area extends the virtual memory space available to the system, and is used when the physical memory space is insufficient.) The swap area may be a disk division accessed via its block special device or a regular file. If the swap area is a regular file, the following options are recognized:

Add the swap area specified by swapdev.

swapdev is the name of the block special device, for example, /dev/dsk/1s0, or the pathname of a regular file. If it is a regular file, swap uses marry(ADM) to create a block special device below /dev/marry that is associated with the regular file.

swaplo is the offset as a number of 512-byte blocks into the device or file where the swap area should begin (default is 0). swaplo may be used to assign a swap area on the same disk partition as a mounted filesystem, but starting above that filesystem. If you specify swaplo, you must also specify swaplen.

swaplen is the length of the swap area as a number of 512-byte blocks (the default 0 uses the full extent of the device or file). A regular file used as a swap area will grow as required to the size imposed by swaplen if there is free space in the filesystem; otherwise, the file will not be extended.

Swap areas are normally added by a system start-up script placed in /etc/rc2.d that is invoked by the system when going into multiuser mode (see rc2(ADM) for more details).

Delete the specified swap area. (swaplo is described for the -a option.)

If the swap area is in use, deletion may take several seconds; it will be refused if there is insufficient memory available.

List the status of all the swap areas. The output has six columns:

The pathname of the swap area.

The major,minor device number of the block special file in decimal.

The offset of the swap area as a number of 512-byte blocks.

The size of the swap area as a number of 512-byte blocks.

The number of free 512-byte blocks currently free in the swap area.

Usually empty, the sixth column shows INDEL if deletion of the swap area has begun but has not yet been completed.


The following is example output from the swap -l command showing two swap areas; the first area occupies a division of the hard disk, the second is a regular file:
   path            dev     swaplo  blocks  free
   /dev/swap       1,41         0   30000 25784
   /swap          76,1          0   15000 25784
The path is displayed as ?????? if the block special file is not found in /dev or /dev/dsk, or it is not in the /dev/marry directory hierarchy in the case of a regular file.


Only root may use the -a and -d options.

A regular file can only be used as a swap area if the marry(ADM) utility and /dev/rmarry character device are present, and the marry(HW) driver configured into the running kernel.

A regular file to be added as a swap area must already exist in the root or another mounted filesystem.

You cannot unmount a filesystem containing a regular file used as a swap area until the swap area is deleted. Halting the system deletes the swap area automatically before unmounting.

No check is done to see if a swap area being added overlaps with an existing swap area or filesystem.


permanent character device file used by marry

full pathname of the marry utility

block device file married to the regular file with pathname path

configures the first swap area for kernel startup; overridden by the swap or swapdev keyword when booting

runs scripts in /etc/rc2.d when going to multiuser mode

See also

boot(HW), marry(ADM), marry(HW), mount(ADM), rc2(ADM), umount(ADM)
© 2007 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 12 June 2007