LinuxQuestions.org
Review your favorite Linux distribution.
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 01-16-2008, 12:26 PM   #1
roofninja
Member
 
Registered: Jan 2006
Location: Asheville, NC
Distribution: 64 bit - ubuntu 7.10
Posts: 84

Rep: Reputation: 15
swap space size?


I am getting my new parts in the next few days and I did not even thing about it until I was reading some posts. I am getting 4gigs of RAM. What size of swap should I have? 4gigs, 6gigs, or no swap.

It is going to be a 64bit system if that makes any difference.
 
Old 01-16-2008, 01:05 PM   #2
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
depends what you're doing with it doesn't it? are you going to need more than 4gb of memory? you *could* need 4gb of physical memory and 16gb of swap due to intensive data processing. You might only actually need 512mb of memory start to finish...
 
Old 01-16-2008, 08:23 PM   #3
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 269Reputation: 269Reputation: 269
Rule of thumb if you're unsure and in doubt and you have plenty of hard disk space, just make it equal to the amount of RAM you have installed. But in reality, you might never use swap, but if you ever do and always use swap, usually indicates you need to add more memory.
 
Old 01-17-2008, 03:05 AM   #4
umar79
LQ Newbie
 
Registered: Oct 2007
Posts: 16

Rep: Reputation: 0
Ya Dear
the size of your swap should be equal to twice your computer's physical RAM for up to 2 GB of physical RAM. For RAM above 2 GB, the size of your swap should be equal to the amount of physical RAM above 2GB.

In your case your RAM size is 16GB then you first start from 18GB swap. and check ur swap usage with time if your system used most of swap space then u could increase it.

swap usage check with following command
cat /proc/swaps
 
Old 01-17-2008, 03:22 AM   #5
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? those "rules of thumb" are generally pointless. if my desktop at home, which i use for web browsing and little else contains 16gb of ram, as that's all PC World would sell me, i'm still meant to have 18gb of swap? it depends if it's going to be needed or not, and throwing away gigs of disk space for no good reason is pointless.
 
Old 01-17-2008, 03:24 AM   #6
DOTT.EVARISTI
Member
 
Registered: Jan 2007
Location: La spezia ( Italia )
Distribution: Fedora 9 amd 64, Gnome,PCLOS 2007,OpenSuse 11 amd 64,Sabayon 3.4,Xp,Vista
Posts: 248

Rep: Reputation: 31
Swap? Not more than 1 gb of hd

As my experience,with the actual distros using more than 512 or 1 gb mb of hd as swap is only a waste of space..for example,i have 2 gb of ram in a pc with fedora 8,fedora usually uses 400 mb of ram only and 128 mb of swap and i did a swap file of 520 mb..on another one,i have 2 gb of ram and opensuse 10.3 and i have the same situation of amount memory of fedora 8...so i suggest you not to use more than 1 gb of hd as a swap file or you'll only waste hd space without any benefits in performances
 
Old 01-17-2008, 07:38 AM   #7
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 269Reputation: 269Reputation: 269
It just all really depends on the environment too. Desktop need 16 or 18GB of swap, hell no. Server, maybe.. just depends.

I've worked on a server that had 64GB of RAM, we had 64GB of swap and it was normal for a few GB of swap to be used as well.

There's the rule of thumb, that's why I said, if you're not sure or in doubt, use it the rule of thumb. But don't use it if you have a system with 4GB of RAM and only a 20GB hard disk, then you'd probably be wasting space.

On my desktops at home, I never go over 512MB of swap.

The arguments of what's right or wrong can and will go on forever as long as swap is around. There really is no right or wrong though. Some people prefer to partition their systems with only /boot, / and swap, wrong and bad idea in my opinion but it's not actually wrong, even though I'll tell someone to at least throw /home, /var, /tmp and /usr on their own directories as well.
 
Old 01-17-2008, 07:42 AM   #8
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
i think it's more the case that the arguments go on forever all the while people keep reading textbooks from 1993...
 
Old 01-17-2008, 07:47 AM   #9
b0uncer
LQ Guru
 
Registered: Aug 2003
Distribution: CentOS, OS X
Posts: 5,131

Rep: Reputation: Disabled
Just as a note so you don't go about making a 100GB swap partition just because you happen to have two 500G harddisks:

A laptop that I use almost daily to access web, write reports, read mail, learn programming (read: occasionally compile programs), retouch some of the photos I shoot (yes, in RAW "format") and so on - daily tasks - has only 512MB of DDR RAM, same amount of SWAP and I've never got it freezing because RAM got full and SWAP got full. Might be magic, but if SWAP is ever used, it's very little - I guess only the photo jobs really stress the thing, and even then it's fully usable: if I want to visit LQ, I just launch a browser and it will come up (and not even wait for a day, like it would on The Other OS). Another thing is that a desktop machine with equal hardware (different brands, but same horsepower here and there) that is running The Other OS takes at least four times longer to boot, uses swap (swapfile) constantly more than this laptop, acts a whole lot slower and practically makes me wonder how such a *fast* (2GHz, 512MB) hardware can be so slow with bad software on board. Especially when compared to this laptop.

So: probably you just don't need that much SWAP. If you must, make it a gigabyte.
 
Old 01-17-2008, 10:38 AM   #10
DOTT.EVARISTI
Member
 
Registered: Jan 2007
Location: La spezia ( Italia )
Distribution: Fedora 9 amd 64, Gnome,PCLOS 2007,OpenSuse 11 amd 64,Sabayon 3.4,Xp,Vista
Posts: 248

Rep: Reputation: 31
Quote:
Originally Posted by b0uncer View Post
Just as a note so you don't go about making a 100GB swap partition just because you happen to have two 500G harddisks:

A laptop that I use almost daily to access web, write reports, read mail, learn programming (read: occasionally compile programs), retouch some of the photos I shoot (yes, in RAW "format") and so on - daily tasks - has only 512MB of DDR RAM, same amount of SWAP and I've never got it freezing because RAM got full and SWAP got full. Might be magic, but if SWAP is ever used, it's very little - I guess only the photo jobs really stress the thing, and even then it's fully usable: if I want to visit LQ, I just launch a browser and it will come up (and not even wait for a day, like it would on The Other OS). Another thing is that a desktop machine with equal hardware (different brands, but same horsepower here and there) that is running The Other OS takes at least four times longer to boot, uses swap (swapfile) constantly more than this laptop, acts a whole lot slower and practically makes me wonder how such a *fast* (2GHz, 512MB) hardware can be so slow with bad software on board. Especially when compared to this laptop.

So: probably you just don't need that much SWAP. If you must, make it a gigabyte.

I agree with you,it happens to me the same way..1 gb of swap is the biggest size possible,i have never ran out of memory too 'cos the Linux kernel has to finish ram size before using full swap size.

Last edited by DOTT.EVARISTI; 01-17-2008 at 10:39 AM.
 
Old 01-17-2008, 07:19 PM   #11
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,659
Blog Entries: 4

Rep: Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941
If I had 4 gigabytes of RAM, I would definitely begin to relax "the rules." I might allocate some amount of swap, just to give my system some "emergency breathing room," but I would not expect the system to actually need to avail itself of it.

In a system with that much available RAM ... which is, of course, a very good situation ... you might not need "swap" at all.
 
Old 01-18-2008, 03:34 AM   #12
DOTT.EVARISTI
Member
 
Registered: Jan 2007
Location: La spezia ( Italia )
Distribution: Fedora 9 amd 64, Gnome,PCLOS 2007,OpenSuse 11 amd 64,Sabayon 3.4,Xp,Vista
Posts: 248

Rep: Reputation: 31
Question Why don't you buy a better video card ?

[quote=sundialsvcs;3026472]If I had 4 gigabytes of RAM, I would definitely begin to relax "the rules." I might allocate some amount of swap, just to give my system some "emergency breathing room," but I would not expect the system to actually need to avail itself of it.

In a system with that much available RAM ... which is, of course, a very good situation ... you might not need "swap" at all.[/quote

You're right..4 gb of ram are even too much too and may be useless..you could spend less money and buy only 2 gb that are already a lot of memory for linux !

4 gb are so much that Vista can' correctly handle them and some games crash on it if they see so much ram and no patches have been released until now,you have to tweak the registry and hope then they work,i saw this in a pc of a friend of mine and read it on a magazine too.

So I suggest you:get 2 gb of ram,make a swap of 512 mb or 1 gb and spend the money you didn't spend for the others 2 gb of ram to buy a better Video card,I suggest you Ge Force 8800 or at least 8500
 
Old 01-18-2008, 03:40 AM   #13
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
to be discussing 4gb of ram in the first place though, you *should* be in enterprise server terrirory. That for a single machine, 4gb may well be fine with no swap. for something like a VMware or Xen host, it would probably be well under specced. where i used to work they used commodity IBM X series boxes with 32gb of ram (which cost more than the server itself) with 32gb of swap. with 50 vm's on them, they started to crawl a bit, and were most definitely using the swap...
 
Old 01-18-2008, 09:29 PM   #14
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,659
Blog Entries: 4

Rep: Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941
When you have that much RAM, you may need to configure your Linux specially, or use a BIGMEM-kernel, to make sure that you can use all of it.

I would simply allocate a modest amount of swap-space, on the assumption that my system will probably never actually use it. (Swap space is used for "hibernating," however.)
 
Old 01-19-2008, 12:04 AM   #15
custangro
Senior Member
 
Registered: Nov 2006
Location: California
Distribution: Fedora , CentOS , RHEL
Posts: 1,979
Blog Entries: 1

Rep: Reputation: 209Reputation: 209Reputation: 209
I usually configure 2 GB of swap....
 
  


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
Swap space size on multi-core systems daWabbit Linux - Desktop 8 09-26-2007 07:21 PM
how much swap space is needed; how to increase swap space? johnpaulodonnell Linux - Newbie 5 03-23-2007 03:20 AM
Why should you give the size of the swap disk as twice the size of RAM vmniza Linux - Newbie 3 09-17-2004 02:13 AM
How to unmount actual swap and mount a new(bigger) swap space? isaac Linux - Newbie 1 06-06-2004 01:23 AM
displaying swap space size with df durden2.0 Linux - Newbie 2 07-14-2003 01:07 AM

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

All times are GMT -5. The time now is 10:47 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