The /usr/sbin/swap command is used to manage swap areas. Two options, –l and –s, 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. For example:
# swap -l swapfile dev swaplo blocks free /dev/dsk/c0t0d0s1 136,1 16 1638608 1600528
On a system with a ZFS root file system, the swap –l command identifies similar output except that it identifies the ZFS volume path name. For example:
# swap -l swapfile dev swaplo blocks free /dev/zvol/dsk/rpool/swap 256,1 16 1058800 1058800
Use the swap -s command to monitor swap resources.
# swap -s total: 57416k bytes allocated + 10480k reserved = 67896k used, 833128k available
The used value plus the available value equals the total swap space on the system, which includes a portion of physical memory and swap devices (or files).
You can use the amount of available and used swap space (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 determine how much swap space is available. When the performance of a system slows down, check the amount of available swap space to determine if it has decreased. Then you can identify what changes to the system might have caused swap space usage to increase.
When using this command, keep in mind that the amount of physical memory available for swap usage changes dynamically as the kernel and user processes lock down and release physical memory.
The output from the swap -s command is summarized in the following table.
|