swap space usage

Robert Gravsjö robert.gravsjo at tietoenator.com
Wed Jan 3 09:17:03 CST 2007



catam skrev:
> 
> Same info comes from ps :)
> 
> ps axu|head -2
> USER       PID %CPU %MEM   VSZ  RSS TTY      STAT START   TIME COMMAND
> root         1  0.0  0.0  1516  376 ?        S     2006   0:28 init
> 
> grep -E 'VmSize|VmRSS' /proc/1/status
> VmSize:     1516 kB
> VmRSS:       376 kB
> 
> 
> On Wed, 3 Jan 2007, Haakon Gjersvik Eriksen wrote:
> 
>>
>> The /proc file system is your friend. You can easily make a list of the
>> biggest processes by doing something like
>> # grep VmSize /proc/*/status  | sort -nr -k 2  | head
>> And then match the PIDs you get out of that to /proc/PID/cmdline to get
>> the process names if PIDs aren't sufficient.

Thanks for swift and good responses! In addition to your advice I also 
found that top can show swap information (use 'f' and add swap by 'p').

regards
/roppert

>>
>> If just getting the biggest process isn't enough, you can try grepping
>> out VmRSS (which is non-swapped-out memory) from /proc and subtracting
>> that from VmSize to get swapped out memory. Shouldn't be too difficult
>> with your favorite scripting language.
>>
>> (sorry, I'm a bit busy so most of this is, unfortunately, left as an
>> exercise for the reader. I figured it might be better than nothing, 
>> though)
>>
>>
> 

-- 
RobertG

Phone: +46 (0)480 44 58 35



More information about the Linux-PowerEdge mailing list