Friday, September 02, 2005

Correct way to find swap size/usage

Correct way to find swap size/usage

Hello,
Which is the best way to find out the total swap space and used swap
space on a Solaris machine?
There are 2 or 3 options, all are giving different values.
1. sar -r
2. swap -l
3. swap -s
4. df -k swap

> Vadi

kstat unix:0:vminfo:*

Reply


What do you mean by 'swap'? There's at least two common definitions
depending on which utility you use.

> There are 2 or 3 options, all are giving different values.
> 1. sar -r
> 2. swap -l
> 3. swap -s
> 4. df -k swap

Don't forget 'top' and 'vmstat'.

Did you read the man pages for them and see what values they are
displaying? They seem rather clear to me....

I'm actually somewhat annoyed by what 'df -k swap' chooses to display.
(I think it should return nothing). 'df' is a utility to show
filesystem information. Using it to understand overall system swap
configuration is not recommended.

Is it ok if we use the output of swap -l - this gives the disk/swapfile
usage
swap -s gives the swap usage including some portion of physical memory.

vmstat gives only available swap, not total swap.
top gives 2 fields : in use & free can we add these?

basically some person will just have to run a command and copy the
values and send them for reporting (as a %) - so if there is a
direct,simple way to get the values...
Thanks!

R
> direct,simple way to get the values...

swap -s | nawk '
{
gsub("k$","",$9);
gsub("k$","",$11);
used=$9;
total=$9+$11;
printf("VM\nTotal: %5d MB\n",total/1024);
printf("Used : %5d MB ",used/1024);
printf("(%d%%)\n",(used*100)/total);

- Hide quoted text -
- Show quoted text -
}'

0 Comments:

Post a Comment

<< Home