LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
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 10-31-2005, 08:15 AM   #1
Gins
Senior Member
 
Registered: Jul 2004
Location: Germany
Distribution: open SUSE 11.0, Fedora 7 and Mandriva 2007
Posts: 1,638

Rep: Reputation: 46
RAM + swapspace


Usually if you put more RAM, your Linux system works faster. This is my belief. In Windows you will find a swap file whereas in Linux it is called a swap space.

Let us say you put 2GB of RAM to your system. What should be the size of the swap space?

I have heard that the Linux doesn't use the swap space until it runs out of RAM memory.

Is this true?
 
Old 10-31-2005, 09:02 AM   #2
TruongAn
Member
 
Registered: Dec 2004
Location: Vietnam (Việt Nam)
Distribution: Gentoo (desktop), Arch linux (laptop)
Posts: 725

Rep: Reputation: 33
I think yes.
I have at once disable swap space on my FC4 box, it boot OK and give me a GUI.
The system look the same as the one with swap enabled but when I launch a applications, the system run slower and slower until all of the RAM is used up (I have only 192 MB RAM), the system become not responding for hours.
So I think you can work without swap, but it depends on how you use your pc.
In my humble opinnion if you have 2 GB RAM, the swap should be 64 MB to provide you enough space to turn off applications which used more RAM than it should use.
 
Old 10-31-2005, 09:14 AM   #3
fouldsy
Senior Member
 
Registered: Jan 2002
Location: St Louis, MO
Distribution: Ubuntu
Posts: 1,284

Rep: Reputation: 47
Rough rule is that the size of your swap space should be equal to twice your computer's RAM, but no larger than 2Gb (though larger swap parition may be possible now as I'm going back a bit since I read that). It varies though - some people say 1 1/2 times the amount of memory. To be honest, you're not really going to be using a swap partition at all with 2Gb RAM.
 
Old 10-31-2005, 10:58 AM   #4
Gins
Senior Member
 
Registered: Jul 2004
Location: Germany
Distribution: open SUSE 11.0, Fedora 7 and Mandriva 2007
Posts: 1,638

Original Poster
Rep: Reputation: 46
I thank both of you for the replies.

So if you have 1GB of RAM, the maximums swap space is 2GB.

If you have 2GB of RAM, the upper limit of RAM is still 2GB. This sounds a bit odd. Are you sure?

What would happen if you have 3 to 5 GB of swap space and 3 or 4 GB of RAM on your system?

Retardation!

Some of my friends have 4 GB of RAM and runs Windows XP. Today it is not unusual to have 4 GB of RAM. There are motherboards which support 4 GB of RAM.
 
Old 10-31-2005, 11:40 AM   #5
fouldsy
Senior Member
 
Registered: Jan 2002
Location: St Louis, MO
Distribution: Ubuntu
Posts: 1,284

Rep: Reputation: 47
As i said, the 2Gb swap limit is probably out of date. But when was the last time you maxed out 4Gb of RAM and needed swap ?
 
Old 10-31-2005, 12:14 PM   #6
WhatsHisName
Senior Member
 
Registered: Oct 2003
Location: /earth/usa/nj (UTC-5)
Distribution: RHL9;F1-10; CentOS4-5; DebianSarge-Squeeze
Posts: 1,151

Rep: Reputation: 46
Gins: You will be wasting a lot of disk space if you use huge amounts of swap. It’s a chicken-and-the-egg argument, but you only need as much swap as you need.

For typical applications that use data files smaller than your ram size and if your ram is larger than 256MB, your swap needs will fluctuate around 1MB, but you will occasionally hit something that needs more. My current standard swap size is 512MB, regardless of ram size.

If you initially pick a swap size that is too small, you can always add another swap partition to fstab to increase the amount of swap available. If swap is defined as an LVM logical volume, then you can resize/reformat the logical volume to match your needs.

But the moment you start using a lot of swap, your system performance will go down the toilet. Any time you see your system using a lot of swap on a regular basis, the first thought on your mind should be “Buy More Memory”.
 
Old 10-31-2005, 01:02 PM   #7
Gins
Senior Member
 
Registered: Jul 2004
Location: Germany
Distribution: open SUSE 11.0, Fedora 7 and Mandriva 2007
Posts: 1,638

Original Poster
Rep: Reputation: 46
Thanks WhatsHisName for the reply.

How much RAM do you have on your system? Your swap space is 512 MB. I would like to know amount of RAM you have.
 
Old 10-31-2005, 01:53 PM   #8
WhatsHisName
Senior Member
 
Registered: Oct 2003
Location: /earth/usa/nj (UTC-5)
Distribution: RHL9;F1-10; CentOS4-5; DebianSarge-Squeeze
Posts: 1,151

Rep: Reputation: 46
The systems tend to cluster around 384MB, 768MB and 1GB of ram.

The one that always amazes me is the Pentium-III with 196MB ram running FC4 that almost never uses more than a few MB of swap.

Of course, if you want to use a lot of swap, just fire up yumex in FC4.

A new swap/ram rule should probably be written that suggests a minimum ram+swap size for modern distros and it might be something like this: For desktops and simple servers, ram plus swap should be at least 512MB and that swap should be at least 128MB. That should work about 99% of the time.
 
Old 10-31-2005, 02:03 PM   #9
foo_bar_foo
Senior Member
 
Registered: Jun 2004
Posts: 2,553

Rep: Reputation: 51
max swap limit of 2GB is a hard limit inherent within ix86 chip memory structure.
you can use a larger partition but only 2GB will be used
you can have as many as 6 (or 8) can't remember of these 2GB partitions used at one time
 
Old 10-31-2005, 02:32 PM   #10
halo14
Senior Member
 
Registered: Apr 2004
Location: Surprise, AZ
Distribution: Debian | CentOS | Arch
Posts: 1,103

Rep: Reputation: 45
Gins, please stop using colored text....

Anyways, If you have 2 GB of RAM in your system you probably have need for SWAP space, depending on how much load the system is under.

In Linux, your swap is not touched unless it really can't fit anything else in to RAM. This is because SWAP is exponentially slower than RAM. Yet, it will always show that you are using close to 100% of RAM, because it will keep recently used stuff in there in case they are to be used again. If you open something else, the oldest and not currently needed, data will be erased to make room for the new application.

If your system is actually utilizing swap space, you really need to add more ram. My laptop runs with 512MB of RAM and I don't ever touch swap space. my swap is only 256MB anyways, just in case it's needed. But it's never utilized.
 
Old 10-31-2005, 02:58 PM   #11
Gins
Senior Member
 
Registered: Jul 2004
Location: Germany
Distribution: open SUSE 11.0, Fedora 7 and Mandriva 2007
Posts: 1,638

Original Poster
Rep: Reputation: 46
I thank everybody for the important comments.
Halo14, I don't know why you dislike the colored texts. It is my belief that people will be attracted by reading colored texts so I would get some good replies.

When you drive your car, you might see all the signs on the highway in blue color. If there is a red color sign, it will definetly get your special attention.


Our friend WhatsHisName mentions about FC4. I don't use Fedora. I use Mandriva.

Last edited by Gins; 10-31-2005 at 03:00 PM.
 
Old 11-01-2005, 05:04 AM   #12
TruongAn
Member
 
Registered: Dec 2004
Location: Vietnam (Việt Nam)
Distribution: Gentoo (desktop), Arch linux (laptop)
Posts: 725

Rep: Reputation: 33
Quote:
posted by WhatsHisName
The one that always amazes me is the Pentium-III with 196MB ram running FC4 that almost never uses more than a few MB of swap.
I don't think so.
I have 196MB RAM and I have once disabled my swap.
The system boot OK, its show me that only 90%RAM being used and 23% is cached. It seems to be amazing but when I start opera, the system run slower and slower and then not responding.
To tell the truth, I am using celeron, not PIII but I think It is not much different.
If you have less than 512MB+ of RAM you must have swap.

And gins, if you have 2GB or RAM I think you don't need swap. But you must be care, when your PC run out of RAM, add swap to it immidiately or it will not respond to your command and you will have to reboot.
 
  


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
lots of ram, do you need swapspace? servnov Linux - Newbie 9 03-19-2006 02:01 AM
suse 9.1 can't create swapspace david.stuart Linux - Newbie 7 08-24-2004 09:00 PM
Sharing swapspace between two Linux installations? mwettach Linux - Newbie 1 03-29-2004 04:44 AM
KNOPPIX q's: *SwapSpace *AddSoftware *boot Iso on /dev/hda1 qwijibow Linux - Distributions 1 02-26-2004 07:31 PM
SwapSpace skate Linux - Newbie 5 09-26-2003 05:16 PM


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

Main Menu
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