System Administration Guide, Volume 1

Monitoring Swap Resources

The /usr/sbin/swap command is used to manage swap areas. Two options, -l and -s, are used to display information about swap resources.

Use the swap -l command to identify a system's swap areas. Activated swap devices or files are listed under the swapfile column.


# swap -l
swapfile           dev  swaplo blocks   free
/dev/dsk/c0t2d0s1 32,17      8 205624 192704

Use the swap -s command to monitor swap resources.


# swap -s
total: 10492k bytes allocated + 7840k reserved = 18332k used, 21568k available

The used plus available figures equals total swap space on the system, which includes a portion of physical memory and swap devices (or files).

You can use the amount of swap space available and used (in the swap -s output) as a way to monitor swap space usage over time. If a system's performance is good, use swap -s to see how much swap space is available. When the performance of a system slows down, check the amount of swap space available to see if it has decreased. Then you can identify what changes to the system might have caused swap space usage to increase.

Keep in mind when using this command that the amount of physical memory available for swap usage changes dynamically as the kernel and user processes lock down and release physical memory.


Note -

The swap -l command displays swap space in 512-byte blocks and the swap -s command displays swap space in 1024-byte blocks. If you add up the blocks from swap -l and convert them to Kbytes, it will be less than used + available (in the swap -s output) because swap -l does not include physical memory in its calculation of swap space.


The output from the swap -s command is summarized in the table below.

Table 38-2 Output of the swap -s Command

Keyword 

Description 

bytes allocated

The total amount of swap space in 1024-byte blocks that is currently allocated as backing store (disk-backed swap space). 

reserved

The total amount of swap space in 1024-byte blocks not currently allocated, but claimed by memory for possible future use. 

used

The total amount of swap space in 1024-byte blocks that is either allocated or reserved. 

available

The total amount of swap space in 1024-byte blocks that is currently available for future reservation and allocation.