cancel
Showing results for 
Search instead for 
Did you mean: 

swap device on Linux

John Guster
Trusted Contributor

swap device on Linux

In Red Hat Linux, is there any restriction of primary swap space to certain type? or can primary swap space be a file system and this file system is the only swap space on the system?
5 REPLIES
Ivan Ferreira
Honored Contributor

Re: swap device on Linux

For performance reasons, you should avoid swap on file system.

Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
Matti_Kurkela
Honored Contributor

Re: swap device on Linux

For performance reasons, the preferable situation is to have enough RAM so that the system will never have to page out non-negligible amounts of data.

But to answer the original question: yes, it is possible, however your system performance will be even worse than with a swap partition if the swap is actually needed in any significant sense.

You can even run a Linux system with no swap at all. But if you simply disable swap and then run out of actual physical RAM, your processes will be immediately subjected to the kernel's Out-Of-Memory Killer routine. (It tries to find the biggest memory hog and kills that process. The results are often effective, but not pretty at all.)

If you need to run without swap, you should examine the values of the vm.overcommit_memory and vm.overcommit_ratio sysctls and adjust them to suit your situation.

http://opsmonkey.blogspot.com/2007/01/linux-memory-overcommit.html

MK
MK
Prasanth V Aravind
Trusted Contributor

Re: swap device on Linux

I have a different thinking ....

I never seen any linux box which using 20% or 40% swap ....

it will always seen 0% used ... eventhough 98% physcical memory has been used...

So i won't think there wen't be a considerable performance issue in linux box ... if you do this change.


i support,You should go for a try, if the mentioned system is a test server

Gudluck
Prasanth
John Guster
Trusted Contributor

Re: swap device on Linux

in conclusion there is no restriction of the type of device as swap space.
dirk dierickx
Honored Contributor

Re: swap device on Linux

@prasand - wow, you must have some underutilized servers at your disposal, you might want to consider to consolidate them...