LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 03-19-2006, 01:22 PM   #1
marc1978
LQ Newbie
 
Registered: Oct 2005
Location: Ottawa in Canada
Distribution: Mandriva 2005 LE (10.2)
Posts: 13

Rep: Reputation: 0
Question Adding more SWAP after adding memory


I've just added 1G of RAM to my system for a total of 1.5G (MANDRAKE 2006 distro)

I currently have 1 GIG for SWAP. I'd like to expand this swap to 2.5 GIGs.

Is there a way to expand my existing SWAP partition or do I need to create a new one? If I need to create a new one, should I delete the existing one and create one single SWAP partition or simply add a second one?

Any help is appreciated on how to do this.

Thanks
 
Old 03-19-2006, 01:38 PM   #2
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,141

Rep: Reputation: 168Reputation: 168
You can add swap partitions to an existing system. Just create the partition and change its partition type to 82 (Linux swap) with fdisk. Then you run mkswap on it (have a look at the man page for its options). You can activate the partition for your current session with swapon. Again, have a look at the man page, particularly the -p option so that you control which swap gets used first.

To make the swap available on booting, add it to /etc/fstab with something like:
Code:
/dev/hda10  none  swap  defaults  0  0
The only question I have is, are you sure you need more swap? I have a Slackware 10.2 box in my test lab with 1.5GB RAM running Oracle 10g and swap usage hasn't been over 200MB (so far).
 
Old 03-19-2006, 01:39 PM   #3
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
why bother? you just bought more RAM! if you're just looking to improve current system performance then you're going to need less swap not more. BUT if you do want to go by that outdated nonsense of swap = 2 x ram then you can just create a new partition as type 83 ( i think that's swap type) and then use mkswap on the new partition and add an entry to /etc/fstab for it. there's no need to delete the old one at all. if you don't want to make a new partition completey you can simply make a swap file instead, use dd to create a file of whatever size you want (1gb = dd if=/dev/null of=/var/swapfile bs=1024 count=1024) and mkswap on that and use it in the same way.
 
Old 03-19-2006, 01:52 PM   #4
marc1978
LQ Newbie
 
Registered: Oct 2005
Location: Ottawa in Canada
Distribution: Mandriva 2005 LE (10.2)
Posts: 13

Original Poster
Rep: Reputation: 0
Thans for the info. Actually Gilead, it's funny you mention oracle 10g because that's the reason I wanted to up the SWAP. The oracle doc. says to have 1.5 X RAM for the amount of RAM that I have.

I guess I'll leave as is then.....no harm in upping later if need be correct?
 
Old 03-19-2006, 03:10 PM   #5
twantrd
Senior Member
 
Registered: Nov 2002
Location: CA
Distribution: redhat 7.3
Posts: 1,440

Rep: Reputation: 52
Quote:
guess I'll leave as is then.....no harm in upping later if need be correct?
Yes, it's fine to leave it as is for now unless you need more. Acid_kewpie is correct. swap=2x RAM is pretty much outdated for today's standards is because back then RAM was expensive.

-twantrd
 
Old 03-19-2006, 03:46 PM   #6
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,141

Rep: Reputation: 168Reputation: 168
That's right - if you just want it to do development work on, it'll run happily on much less than that. I've had Oracle 10g running on a PIII 1.6GHz with 512MB RAM and 512MB swap without complaining.

I've never tried loading it seriously to see how quickly it would collapse though, it was just for the developers here to tinker with.
 
Old 03-19-2006, 07:13 PM   #7
J.W.
LQ Veteran
 
Registered: Mar 2003
Location: Boise, ID
Distribution: Mint
Posts: 6,642

Rep: Reputation: 87
The only time you really need swap is if the current load pushes RAM past its capacity, and the system is forced to write memory pages out to disk. The more RAM you have, the less likely that is. Given that reads/writes from a physical device are measured in milliseconds, and reads/writes within RAM are measured in nanoseconds, you really don't want to be using swap much at all. Personally, I define a 256Mg swap space, regardless. Disclaimer: high-traffic, heavily loaded servers may (or will) need more, but for a desktop and/or light duty server, you don't need very much swap at all.

The old "swap = 2xRAM" rule of thumb dates from the 90's, where having 32Mg of RAM was considered leading edge, and it was relatively easy to consume 100% of your memory. These days, where 512Mg or 1G RAM systems are pretty much standard, the need for swap has more or less evaporated
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
adding swap space gadekishore Linux - Networking 2 02-18-2006 12:32 PM
Adding swap space sbrewer Linux - Distributions 4 12-19-2004 04:32 AM
adding swap space jamaso Slackware 6 06-20-2004 11:05 PM
Adding More Ram...More Swap Needed? Crashed_Again Linux - Hardware 4 03-12-2004 10:00 AM
adding memory?? bac()n Linux - Newbie 7 03-30-2003 09:56 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 04:11 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
Open Source Consulting | Domain Registration