[CentOS] Swap priorities with swapon (Is my swap drive working?)

Fri Jun 5 09:15:00 UTC 2009
RedShift <redshift at pandora.be>

James Bensley wrote:
> Hey Listee's
> 
> I have a CentOS server with 2GB of ram and a swap drive of 4GB;
> 
> swapon -a shows my swap drive as 4GB with only about 350 bytes in use
> (which is fine as my server idles with about 350-400MB ram usage so no
> swap should be in use. However my one and only swap drive had a
> priority of -1. I had read that the swap drive priority doesn't matter
> too much because I only have one swap drive so the kernel hasn't got
> to make a choice but also that after a certain kernel version (which
> is think was like 1.3.x?) it didn't even use the priority value and my
> kernel is newer (I have 2.6.18-128.1.6.e15).
> 
> Basically I have read difference things from difference source on the
> old interwebwrok and seek clarification. In the confusion I set my
> swap drive priority from -1 to 1 because I thought that if the drive
> priority were a negative value it might not actually use the swap
> drive. Ultimately I can't tell because there currently isn't enough
> memory usage demand on the server.
> 
> On a side note: I'm a reformed Windows admin and have seen the light
> and am moving each server one at a time over to Linux so I am used to
> poor memory management and needing massive page files. Realistically
> the swap drive shouldn't been in use but I am just worried then when
> this server goes live it will hit 2GB of ram usage and the swap won't
> kick in. Is there anyway I can check?
> 

If your system starts to swap, it really needs more memory. Otherwise you're just fine. Swap is only a last resort.

Don't worry about it.


Glenn