Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

When looking vmstat, this is what I got:

procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------
r b swpd free buff cache si so bi bo in cs us sy id wa st
1 0 0 2872 0 0 0 0 8 17 0 14 3 1 94 2 0


the cache is 0. I have no idea how much the whole swap I have.

But when not enough RAM (256 MB), the swap will be used and look like below:

procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------
r b swpd free buff cache si so bi bo in cs us sy id wa st
3 1 2468 0 0 0 0 0 8 17 0 16 3 1 94 2 0

share|improve this question
add comment

5 Answers

Assuming this is on Linux - free -m will show you how much memory/swap you have in MB. Or cat /proc/meminfo

share|improve this answer
add comment

To see information about swap files currently in use on Linux:

cat /proc/swaps

or refer to swap information in meminfo for less detail:

cat /proc/meminfo | grep Swap

share|improve this answer
add comment

One of the header lines in top will be Swap info, and it's very clearly broken down.

This also has the advantage of working on any platform where top is installed (Every Linux/BSD I know of. Most Solaris, AIX & HP-UX machines (if it didn't come with the system some admin usually got around to installing it)).

share|improve this answer
    
(I got from top) Swap: 0k total, 0k used, 0k free, 0k cached –  Cintaku Jan 29 '10 at 18:18
2  
Sounds like you don't have any swap configured (or it's not attached/enabled) -- that's a bit unusual but not impossible. Are there any lines in /etc/fstab with type "swap"? If so try "swapon -a" (as root) & the system will try to enable them. –  voretaq7 Jan 29 '10 at 20:15
1  
True that top is almost everywhere, but I was surprised to find it missing on Tru64. Not that anyone cares about that any more... –  Mei Dec 24 '10 at 21:23
    
htop is a more friendly version. :) –  EricR Nov 4 '11 at 17:42
    
@EricR - True, but htop isn't everywhere (for that matter neither is top, but you know it will be there on the systems I listed). I suppose the truly portable alternative is swapinfo, but that requires you to do your own math for totals if you have more than one swap partition - top does it for you :-) –  voretaq7 Nov 4 '11 at 18:22
add comment

Execute

mkswap /path/to/dev

Then run

swapon -a
share|improve this answer
add comment

Many systems have some command to detail this information outright: the commands are usually one of: swap or swapinfo or swapon (with appropriate option). Look up the man pages for these commands to find the specific information.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.