Add the specified swap area. swapname is the name of the block special partition, for example, /dev/dsk/*, where the value of * is machine dependent, or a regular file. swaplow is the offset in 512-byte blocks into the partition where the swap area should begin.
swaplow gives the starting offset of the portion of the file to be used as swap (in 512 byte block units).
swaplen gives the length of the file to be used as swap (in 512 byte block units). The maximum allowable swaplen is 8388608 512-byte blocks, or 4GB (4 gigabytes).
If both swaplow and swaplen are omitted, then the entire device or file is used for swap space. If a single number is specified on the command line, then it is taken to mean swaplen. In this case swaplow defaults to 0 (the beginning of the file). If two numbers are specified on the command line, then the first is used as swaplow and the second is used as swaplen.
The actual area used by the operating system may be slightly smaller due to filesystem page-size rounding.
Configure the swap area by adding all the devices and files listed in filename as swap devices. If no filename option is given, /etc/swaptab is used as the input file.
Delete the specified swap area. swapname is the name of block special partition, for example, /dev/dsk/*, where the value of * is machine dependent, or a regular file.
swaplow is the offset in 512-byte blocks into the partition specifying the beginning of the swap area to be deleted. If swaplow is omitted, an offset of zero is assumed. While the delete operation is in process, the swap area is marked as ``INDEL'' (in the process of being deleted). A concurrently executed swap -l command could observe the INDEL state and report it at the end of the line listing the swap area. The system will not allocate any new blocks from the area, and will try to free swap blocks from it. The area will remain in use until all blocks from it are freed. When the swap command completes, the deletion is also complete.
path
dev
swaplo
blocks
free
allocated
reserved
used
available
#swapname offset(in blocks) size(in blocks) /dev/swap 0 - /dev/dsk/c0b0t1d0s2 0 - /dev/dsk/c0b0t2d0s2 0 - /dev/dsk/c0b0t3d0s2 0 - /dev/dsk/c0b0t4d0s2 0 - /dev/dsk/c0b0t5d0s3 0 - /dev/dsk/c0b0t6d0s2 0 -
For good performance, construct the swap space out of disk slices rather than files. When multiple disk slices are used, they should be equal in size, and placed on separate disks. See disksetup(1M) for information on configuring disk slices. Should you wish to change the slice structure on a disk following setup, you can use prtvtoc(1M) and edvtoc(1M).
If you have licensed the VERITAS advanced Volume Manager product, an alternative to using many slices for swap might be to use a Volume Manager based ``volume''. For example:
#swapname offset(in blocks) size(in blocks) /dev/vx/dsk/swapvol 63,1 0 881280 811128
It may not always be possible to find an extra slice to solve a swap problem. In that case, a file can be used. To use a regular file as swap space, you need to create a file as big as the intended swap space. It is not enough to simply create a zero-length file; it must be as large as the intended swap space.
To do this, you can use the dd(1M) command, as shown in the following example (which creates 1GB of swap space):
dd if=/dev/null of=/swapfile oseek=1024 bs=1024k
Then add the following line to /etc/swaptab:
/swapfile 0 -
Then issue this command:
swap -c
The system will use the new swap file following the next reboot, because swap -c is run from /etc/inittab at system start time.
SC_REMOVE failed
No check is done to see if a swap area being added overlaps with an existing filesystem.
Files in general are not recommended for use as swap storage (disk slices or Volume Manager volumes are preferred). Should use of a file be needed, disk based file systems are preferred over NFS. Failure to follow these recommendations can result in poor performance or system instability.