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

Fri Jun 5 09:20:01 UTC 2009
Ralph Angenendt <ra+centos at br-online.de>

James Bensley wrote:
> 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.

If you only have one swap area (this sounds like it), you don't need to
worry about priorities at all. Only when more than one swap area comes
into play, then the kernel decides by priority which swap areas should
be used over other ones (ie, have the swap on fast disks have a high
priority and the swap on slower disks a lower priority). If you have two
swap aread with the same priority, they will be used in a round-robin
fashion.

See man 2 swapon for an explanation.

> 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?

It will kick in, regardless of priority. 

But probably someone will come up with a small c program which eats all
available memory :)

Regards,

Ralph
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.centos.org/pipermail/centos/attachments/20090605/9aa88d1d/attachment-0005.sig>