Display Solaris Swap Information

Having an appropriate amount of swap space is important for optimal system performance. Simple commands allow monitoring swap space utilization.

To get a summary of total system swap space, use the swap command:

swap -s

total: 597744k bytes allocated + 99760k reserved = 697504k used, 095216k available

The output of the swap -s command shows the amount of swap space used (697504KB in this example) and available (95216KB) and further breaks down the used swap space into allocated and reserved. Allocated space represents swap space currently in use. Reserved space is in limbo, not available, not in use, but reserved for future use.

To get details on the individual devices or files that constitute the swap space, use the following:

swap -l

swapfile dev swaplo blocks free
/dev/dsk/c0t0d0s1 32,1 16 2624560 2624560
/dev/dsk/c0t8d0s1 32,57 16 2624560 2624560

The swapfile column is the device or filename of the swap component. The dev column shows the major and minor device numbers for devices or zeros for a file. Blocks is the total size of the swap component in 512 byte blocks (divide by two for KB) and free shows the number of 512 byte blocks unused.


About Quinn McHenry

Quinn was one of the original co-founders of Tech-Recipes. He is currently crafting iOS applications as a senior developer at Small Planet Digital in Brooklyn, New York.
View more articles by Quinn McHenry

The Conversation

Follow the reactions below and share your own thoughts.

  • scubie

    What would the “–” mean under dev?
    [[email protected] u02]# swap -l
    swapfile dev swaplo blocks free
    /dev/dsk/c1t0d0s1 32,1 16 4100912 4100912
    /u02/rootswap – 16 1023984 1023984
    /u02/swapfile – 16 4194288 4194288

  • shree

    I notice some swap size descripancy on my solaris servers. On T2000 , I only have one slice for swap and got 11GB swap space. whic is show format command . See details below and df -f command it show diffrent

    partition> p
    Current partition table (original):
    Total disk cylinders available: 65533 + 2 (reserved cylinders)

    Part Tag Flag Cylinders Size Blocks
    0 root wm 0 – 54237 56.28GB (54238/0/0) 118021888
    1 swap wu 54238 – 65532 11.72GB (11295/0/0) 24577920
    2 backup wm 0 – 65532 68.00GB (65533/0/0) 142599808
    3 unassigned wm 0 0 (0/0/0) 0
    4 unassigned wm 0 0 (0/0/0) 0
    5 unassigned wm 0 0 (0/0/0) 0
    6 unassigned wm 0 0 (0/0/0) 0
    7 unassigned wm 0 0 (0/0/0) 0

    [email protected] # swap -l
    swapfile dev swaplo blocks free
    /dev/dsk/c0t0d0s1 32,9 16 24577904 24577904
    [email protected] #

    [email protected] # df -h
    Filesystem size used avail capacity Mounted on
    /dev/dsk/c0t0d0s0 55G 9.3G 46G 17% /
    /devices 0K 0K 0K 0% /devices
    ctfs 0K 0K 0K 0% /system/contract
    proc 0K 0K 0K 0% /proc
    mnttab 0K 0K 0K 0% /etc/mnttab
    swap 16G 1.4M 16G 1% /etc/svc/volatile
    objfs 0K 0K 0K 0% /system/object
    55G 9.3G 46G 17% /platform/sun4v/lib/libc_psr.so.1
    55G 9.3G 46G 17% /platform/sun4v/lib/sparcv9/libc_psr.so.1
    fd 0K 0K 0K 0% /dev/fd
    swap 16G 1.2M 16G 1% /tmp
    swap 16G 48K 16G 1% /var/run

  • kishore

    what is swap?why we require swap?