Ubuntu – Why is zero swap being used on the setup


From the looks of the swaps proc;

ubuntu:~$ cat /proc/swaps
Filename                Type        Size    Used    Priority
/dev/sdc2                               partition   4104188 0   -1

And from top:

ubuntu:~$ top

top - 09:35:37 up  9:07,  9 users,  load average: 1.43, 0.80, 1.09
Tasks: 206 total,   3 running, 202 sleeping,   0 stopped,   1 zombie
Cpu(s):  4.4%us,  2.2%sy,  0.0%ni, 50.5%id, 42.5%wa,  0.0%hi,  0.3%si,  0.0%st
Mem:   3088492k total,  2619440k used,   469052k free,   238536k buffers
Swap:  4104188k total,        0k used,  4104188k free,  1769788k cached

Both say that zero swap is actually being used.

I'm using a 64bit capable core2 duo dell laptop with 4gigs of ram running 32bit ubuntu precise on a persistent live USB stick.

I may be answering my own question but I wonder if the liveUSB stick nature of the environment is somehow related…

Let me know if you need more information.

Best Answer

Swap is kind of a "safety net" in case you run out of RAM, so the fact that it's not used until actually needed is entirely normal.

You're not using any swap because all the processes fit in your RAM. You won't actually see swap being used util processes actually need more space. Try opening a lot of tabs on your browser, or install the stress tool which you can use to stress your system's memory, and you will see swap being used.

Related Question