LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   How can I increase swap space? (https://www.linuxquestions.org/questions/linux-server-73/how-can-i-increase-swap-space-609244/)

abefroman 12-26-2007 01:06 PM

How can I increase swap space?
 
How can I increase swap space?

I added more RAM to my server and want to increase my swap space and decrease my / partition which has extra space.

How can I do that without reinstalling the OS?

joel2001k 12-26-2007 01:18 PM

use a partition editor that supports resizeing
 
I'm using _ GNU/Linux debian unstable main _ it's very nice and I believe that there are tools that should be able to do this (I've not tested them, so I say believe)

look for `parted` or `gparted`

David1357 12-26-2007 01:44 PM

Quote:

Originally Posted by abefroman (Post 3002095)
How can I do that without reinstalling the OS?

You can boot your system using System Rescue CD. Then type "startx" and use "gparted" to resize your partitions.

forrestt 12-26-2007 02:09 PM

You can also just create a file in your / partition (or any partition for that matter) and use that file as extra swap space. This is much easier and a lot less risky than modifying your partition sizes. http://www.redhat.com/docs/manuals/l...ap-adding.html describes the process for adding a swap partition or swap file.

HTH

Forrest

abefroman 12-26-2007 03:32 PM

Quote:

Originally Posted by forrestt (Post 3002143)
You can also just create a file in your / partition (or any partition for that matter) and use that file as extra swap space. This is much easier and a lot less risky than modifying your partition sizes. http://www.redhat.com/docs/manuals/l...ap-adding.html describes the process for adding a swap partition or swap file.

HTH

Forrest

Thanks! That worked good and I was able to do it remotely.

forrestt 12-26-2007 04:54 PM

Glad I could help.

Forrest

syg00 12-26-2007 05:57 PM

Some comments:
- only use swap files on a 2.6 kernel, not 2.4
- if you expect to actually use swap, make all the extents the same priority; kswapd will then stripe the I/O.
- if you expect to actually use swap heavily don't put it on the same disk (let alone same partition) as anything else.

Preferably don't swap at all, then the above don't matter ... ;)

win32sux 12-26-2007 06:07 PM

Quote:

Originally Posted by syg00 (Post 3002310)
only use swap files on a 2.6 kernel, not 2.4

Can you elaborate? I don't recall ever having had any issues with swap files on Linux 2.4.

syg00 12-26-2007 06:17 PM

Maybe I should have moved that down the list - it's a performance rather than a functional consideration.
2.6 doesn't differentiate the I/O, so swap is always handled by the (block) device layer - 2.4 had filesystem involvement, so the code path-length was longer for swap files compared to swap partitions.

abefroman 12-26-2007 09:44 PM

Quote:

Originally Posted by syg00 (Post 3002310)
Some comments:
- if you expect to actually use swap heavily don't put it on the same disk (let alone same partition) as anything else.

I am using about 2GB of the swap and already have 4GB of ram used up, and I expect to use more of the swap space, should I put one swap partion on one drive and one swap partition on another?

syg00 12-27-2007 12:36 AM

Generally I would always say "yes".
What really matters is the swap rate rather than (absolute) number of used slots in the swap space.

forrestt 12-27-2007 09:55 AM

Arguing about the speed of swap is like arguing about the speed of water buffalo. Even the fastest one is slower than almost anything else. Swap should be thought about as a temporary solution to a memory shortage problem. It is necessary when it is needed, but shouldn't be counted on as the way to win any races.

HTH

Forrest

David1357 12-27-2007 11:23 AM

Quote:

Originally Posted by abefroman (Post 3002470)
I am using about 2GB of the swap and already have 4GB of ram used up, and I expect to use more of the swap space...

If you are accessing your swap space so frequently that you are constantly thrashing your drive(s), you will probably cause a premature drive failure. There is no better solution to this problem than more RAM. However, if you are using a basic off-the-shelf motherboard, you may have hit your limit.


All times are GMT -5. The time now is 09:42 AM.