RE: SOLVED Case of the missing swap

From: Bruce Caldwell (caldwell@kenetinc.com)
Date: Mon Oct 27 2003 - 17:43:49 EST


As Aaron Taylor and Caspter Dik accurately and quickly pointed out /tmp
uses up swap.

Answer:
/tmp was filling. I had thought that my swap partitions were on their
own and not in /tmp.

Thanks!

> df
swap 3782832 32 3782800 1% /var/run
swap 11022312 7239512 3782800 66% /tmp

root@cruncher: /tmp/ > swap -l
swapfile dev swaplo blocks free
/dev/dsk/c1t0d0s1 118,9 16 16779296 2833872
/swapfile - 16 4194288 3486448

> -----Original Message-----
> From: sunmanagers-bounces@sunmanagers.org
> [mailto:sunmanagers-bounces@sunmanagers.org] On Behalf Of
> Bruce Caldwell
> Sent: Monday, October 27, 2003 5:16 PM
> To: sunmanagers@sunmanagers.org
> Subject: Case of the missing swap
>
>
> Hi folks,
>
> I want to find out where my swap is going to. Top reports 8
> gig in use on its summary. But when I total the lines I get
> Less than 2 gig. Where is it all?? Top correlates with memps -p.
>
> ./totalswap.pl
> 150 processes: 138 sleeping, 11 zombie, 1 on cpu
> Memory: 2048M real, 818M free, 8054M swap in use, 3579M swap free
>
> TOP: Total swap used is 1175 Meg
> memps output 1191.104M
>
>
> Machine is a Sun 280 running solaris 2.8.
>
> The zombies aren't supposed to take any resources
> (http://rsusu1.rnd.runnet.ru/solaris2.7/Solaris_System_Adminis
tration_Gu
ide-stripped/ch01/025-027.html)

caldwell@cruncher: /netapp/home/caldwell/bin/ > swap -s
total: 8160984k bytes allocated + 85952k reserved = 8246936k used,
3665192k available

Perl script to grock top and memps:
#!/usr/bin/perl -w

# run top then add up total swap needed
open (TOP, "top -b 10000|") || die "cannot run top $!\n" ;

while (<TOP>) {
    print ;
    last if (/PID USERNAME/) ;
}

while (<TOP>) {
    @fields = split (/\s+/, $_) ;
    $size = $fields[6] ; # first char is a space
    $size =~ /(\d+)([KMG])/ ;
    $units = $2 ; $size = $1 ;
    if ($units =~ /M/) {
        $total += ($size * 1e6) ;
    } else {
        if ($units =~ /K/) {
            $total += ($size * 1e3) ;
        }
    }
# print "$total $_" ;
}

printf "TOP: Total swap used is %d Meg\n", $total/1e6 ;

open (MEMPS, "memps -p |") || die "cannot open memps : $!\n" ; while
(<MEMPS>) {
    next if (/PID /) ;
    @fields = split (/\s+/, $_ ) ;
    $size = $fields[2] ;
    $size =~ s/k// ;
    $mempstotal += $size * 1000 ;
# print "$mempstotal $_" ;
}
$mempstotal = $mempstotal/1e6 ;
print "memps outpout $mempstotal\M \n";

Thanks,
Bruce Caldwell
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers



This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 23:27:22 EDT