swap(ADM)


swap -- administer swap space

Syntax

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

/etc/swap -d swapdev [ swaplo ]

/etc/swap -l

Description

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:

-a
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).


-d
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.


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

path
The pathname of the swap area.

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

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

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

free
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.

Examples

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.

Limitations

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.

Files


/dev/rmarry
permanent character device file used by marry

/etc/marry
full pathname of the marry utility

/dev/marry/path
block device file married to the regular file with pathname path

/etc/conf/cf.d/sassign
configures the first swap area for kernel startup; overridden by the swap or swapdev keyword when booting

/etc/rc2
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