LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices



Reply
 
Search this Thread
Old 12-26-2007, 02:06 PM   #1
abefroman
Senior Member
 
Registered: Feb 2004
Location: lost+found
Distribution: CentOS
Posts: 1,278

Rep: Reputation: 53
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?
 
Old 12-26-2007, 02:18 PM   #2
joel2001k
Member
 
Registered: Mar 2007
Distribution: GNU/Linux debian unstable main
Posts: 79

Rep: Reputation: 17
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`

Last edited by joel2001k; 12-26-2007 at 02:19 PM.
 
Old 12-26-2007, 02:44 PM   #3
David1357
Senior Member
 
Registered: Aug 2007
Location: South Carolina, U.S.A.
Distribution: Ubuntu, Fedora Core, Red Hat, SUSE, Gentoo, DSL, coLinux, uClinux
Posts: 1,302
Blog Entries: 1

Rep: Reputation: 107Reputation: 107
Quote:
Originally Posted by abefroman View Post
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.
 
Old 12-26-2007, 03:09 PM   #4
forrestt
Senior Member
 
Registered: Mar 2004
Location: Cary, NC, USA
Distribution: Fedora, Kubuntu, RedHat, CentOS, SuSe
Posts: 1,288

Rep: Reputation: 99
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
 
Old 12-26-2007, 04:32 PM   #5
abefroman
Senior Member
 
Registered: Feb 2004
Location: lost+found
Distribution: CentOS
Posts: 1,278

Original Poster
Rep: Reputation: 53
Quote:
Originally Posted by forrestt View Post
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.
 
Old 12-26-2007, 05:54 PM   #6
forrestt
Senior Member
 
Registered: Mar 2004
Location: Cary, NC, USA
Distribution: Fedora, Kubuntu, RedHat, CentOS, SuSe
Posts: 1,288

Rep: Reputation: 99
Glad I could help.

Forrest
 
Old 12-26-2007, 06:57 PM   #7
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,497

Rep: Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077
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 ...
 
Old 12-26-2007, 07:07 PM   #8
win32sux
Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 371Reputation: 371Reputation: 371Reputation: 371
Quote:
Originally Posted by syg00 View Post
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.
 
Old 12-26-2007, 07:17 PM   #9
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,497

Rep: Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077
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.
 
Old 12-26-2007, 10:44 PM   #10
abefroman
Senior Member
 
Registered: Feb 2004
Location: lost+found
Distribution: CentOS
Posts: 1,278

Original Poster
Rep: Reputation: 53
Quote:
Originally Posted by syg00 View Post
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?
 
Old 12-27-2007, 01:36 AM   #11
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,497

Rep: Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077
Generally I would always say "yes".
What really matters is the swap rate rather than (absolute) number of used slots in the swap space.
 
Old 12-27-2007, 10:55 AM   #12
forrestt
Senior Member
 
Registered: Mar 2004
Location: Cary, NC, USA
Distribution: Fedora, Kubuntu, RedHat, CentOS, SuSe
Posts: 1,288

Rep: Reputation: 99
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
 
Old 12-27-2007, 12:23 PM   #13
David1357
Senior Member
 
Registered: Aug 2007
Location: South Carolina, U.S.A.
Distribution: Ubuntu, Fedora Core, Red Hat, SUSE, Gentoo, DSL, coLinux, uClinux
Posts: 1,302
Blog Entries: 1

Rep: Reputation: 107Reputation: 107
Quote:
Originally Posted by abefroman View Post
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how much swap space is needed; how to increase swap space? johnpaulodonnell Linux - Newbie 5 03-23-2007 04:20 AM
How do I increase my swap space on RH Linux AS 4.0 pdillard Linux - Software 3 01-19-2007 03:37 AM
How to unmount actual swap and mount a new(bigger) swap space? isaac Linux - Newbie 1 06-06-2004 02:23 AM
How to increase SWAP partition space ? sureshsaragadam Linux - Newbie 23 10-01-2003 10:24 AM
Increase Swap Space? star geezer Linux - Software 9 03-10-2003 01:04 PM


All times are GMT -5. The time now is 10:02 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration