LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-03-2008, 05:26 PM   #1
ritam_bkp
Member
 
Registered: Sep 2008
Location: Calcutta,India
Distribution: Fedora 11, OpenSUSE 11.0
Posts: 116

Rep: Reputation: 17
Exclamation proper size of SWAP


i have an intel core2 duo machine..
with 2GB of RAM,80GB HDD
I want to install fodora core 9
what size should i provide for SAWAP partition????

"SWAP size should be double of RAM size"
----i found this statement in many articles..

So should i give the size of my swap 4GB???
 
Old 10-03-2008, 05:40 PM   #2
linux-lover
LQ Newbie
 
Registered: Oct 2006
Posts: 16

Rep: Reputation: 0
SWAP depends on what Apps/programs your machine will run. Usually it is recommended as 1.5 the amount of RAM or Double the RAM.
 
Old 10-03-2008, 06:08 PM   #3
Quakeboy02
Senior Member
 
Registered: Nov 2006
Distribution: Debian Squeeze 2.6.32.9 SMP AMD64
Posts: 3,275

Rep: Reputation: 126Reputation: 126
If you can ever imagine yourself needing to occupy more than your 2GB of RAM while you're running your computer, AND if you can imagine that any of that being on a hard drive would be a Good Thing (TM), then by all means use double that: 2GB. In the end, it doesn't matter whether you set it to 2GB or some other value, because you'd hate the operation of your machine so much when it started paging that you'd either buy more memory or a faster machine.

The "double the amount of memory" rule of thumb came about when 64K was the normal size of a machine, and gigabytes of memory wasn't even a geeks wet dream. If you think about it, these days the amount of memory in a machine is no longer budget driven, but convenience driven. IOW, whatever it's convenient for the manufacturer to put in, that's what you get.

If you monitor your memory usage, and if you aren't doing a lot of video editing or something like that, you'll probably never see usage go above 500MB. Heck, you may never even cross 300MB. Given that, the amount of swap space is irrelevant. A number of people run without any swap space at all. Me, I don't give it any thought unless I'm installing on a really old hard drive without any room to spare. Normally I just accept whatever the OS wants, because hard drives are so big today that throwing a few GB away really doesn't matter. But, if I really cared, I'd choose 0.
 
Old 10-03-2008, 06:23 PM   #4
ritam_bkp
Member
 
Registered: Sep 2008
Location: Calcutta,India
Distribution: Fedora 11, OpenSUSE 11.0
Posts: 116

Original Poster
Rep: Reputation: 17
...............................

Last edited by ritam_bkp; 10-03-2008 at 06:25 PM.
 
Old 10-03-2008, 06:24 PM   #5
ritam_bkp
Member
 
Registered: Sep 2008
Location: Calcutta,India
Distribution: Fedora 11, OpenSUSE 11.0
Posts: 116

Original Poster
Rep: Reputation: 17
Quote:
Originally Posted by Quakeboy02 View Post
If you monitor your memory usage, and if you aren't doing a lot of video editing or something like that, you'll probably never see usage go above 500MB. Heck, you may never even cross 300MB. Given that, the amount of swap space is irrelevant. A number of people run without any swap space at all. Me, I don't give it any thought unless I'm installing on a really old hard drive without any room to spare. Normally I just accept whatever the OS wants, because hard drives are so big today that throwing a few GB away really doesn't matter. But, if I really cared, I'd choose 0.
thanx guys....
i have much space and memory..
but this doesn't imply that i should waste it unnecesarily
i asked dis question as i was a bit confused...
that was a good suggestion..

i have also used a low configuration machine for past 7 years(2001-2007)
it was a P-2 machine with 10Gb HDD and 64MB RAM
I undrstand the value of computer resources,
in those days i used win98 and rehat
 
Old 10-03-2008, 06:27 PM   #6
nny0000
Member
 
Registered: Aug 2003
Distribution: Slackware, Ubuntu
Posts: 158

Rep: Reputation: 30
My Linux Box runs with a 1GB swap partition and I have had no problems with it. Although my box only has 512MB of RAM. So I would say 1-2x your amount of RAM will work.

Granted, you could run without any swap drive if you really wanted to but I wouldn't advise it. I take the better safe than sorry approach. Just throw 'swap' a gig or two, it might save you someday when you might do some video editing.
 
Old 10-03-2008, 06:43 PM   #7
ritam_bkp
Member
 
Registered: Sep 2008
Location: Calcutta,India
Distribution: Fedora 11, OpenSUSE 11.0
Posts: 116

Original Poster
Rep: Reputation: 17
Wink

Quote:
Originally Posted by nny0000 View Post
My Linux Box runs with a 1GB swap partition and I have had no problems with it. Although my box only has 512MB of RAM. So I would say 1-2x your amount of RAM will work.

Granted, you could run without any swap drive if you really wanted to but I wouldn't advise it. I take the better safe than sorry approach. Just throw 'swap' a gig or two, it might save you someday when you might do some video editing.
yah
i guess i may allot 768Mb of HDD for my swap partition
 
Old 10-03-2008, 06:49 PM   #8
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181
I think using zero swap space on an ordinary Linux system is a bad idea.

Most people who discuss this swap space issue in this and many similar threads don't seem to understand that an OS constantly decides between ram and disk for a lot of different types of content only a fraction of which would go in swap space if it were available (the rest are various things that boil down to mapped files).

There will be some content with virtually zero access rate that can go only in swap or ram. There will be other content with higher access rate that is mapped to files, so when it is bumped from ram it is not written to swap. If you don't have enough swap space to write out the inactive content, that will force Linux to bump more active content and will make your system slower.

How much inactive content there is that ought to be in the swap area depends on what sort of applications you're running. Typically, it would be much higher on a server than on a workstation, but that could go very much the other way depending on how you use your workstation. Maybe all that inactive stuff adds up to such a small fraction of 2GB that you'd barely notice the improvement from having a small swap space vs. zero and that a big swap space would be almost entirely unused. I don't know how to tell other than trying with enough swap space that it never all gets used.

There are also complex issues of throughput vs. responsiveness. Ordinary Linux can prioritize CPU use well but can't really prioritize memory use or disk I/O, so large operations and/or background operations tend to get more memory than the end user would like, which makes them only a little faster while making it much slower to switch back to some program you left paused. Some people use an intentional lack of swap space to detune the throughput of the system in favor of faster return to paused programs. Generally there are better ways to achieve that tuning than starving the system of swap space.

The various old rules, such as 1.5 or 2 time ram never made any sense. With ordinary workstations having large amounts of ram, they make even less sense.

If you're not running anything unusual on a 2GB Linux with 80GB hard drive, and you're not planning to nearly fill that drive with data. I suggest using a 500MB swap partition and on rare occasion check to see if it is being used. If a small fraction of it is in use, perfect. If a large fraction is in use, something should be corrected.

If you plan to use enough of your 80GB drive for programs or data that you'd miss .5GB "wasted" on a barely used swap partition, get rid of the drive and buy a real one.

Edit: I wrote all this before seeing your post immediately above. 768MB is a fine choice.

Also, I see "video editing" mentioned in this thread, but not by you. For some "video editing" tools there will be things that work when the total ram+swap is at least 3.5GB and break for reasons an ordinary user wouldn't understand when there is less (in such cases the program wouldn't actually be using the full 3GB even if it were there). It isn't very common, but if you were the one who had mentioned "video editing" I would have said why risk such problems vs "wasting" a full 1.5GB on swap. For web browsing and most other home computer uses, there is no similar issue and it is very unlikely that 500MB would be too little swap space.

Last edited by johnsfine; 10-03-2008 at 07:02 PM.
 
Old 10-03-2008, 06:59 PM   #9
Quakeboy02
Senior Member
 
Registered: Nov 2006
Distribution: Debian Squeeze 2.6.32.9 SMP AMD64
Posts: 3,275

Rep: Reputation: 126Reputation: 126
Here is a link to what is the definitive argument on swap. I say argument, because it's an argument between kernel developers about the setting of the swappiness variable which directly impacts swapping. I haven't read it in a long time, but I don't remember any strong arguments against zero swap space.

http://kerneltrap.org/node/3000
 
Old 10-03-2008, 07:03 PM   #10
ritam_bkp
Member
 
Registered: Sep 2008
Location: Calcutta,India
Distribution: Fedora 11, OpenSUSE 11.0
Posts: 116

Original Poster
Rep: Reputation: 17
Quote:
Originally Posted by johnsfine View Post
I wrote all this before seeing your post immediately above. 768MB is a fine choice.
thank u....
this was a really good discussion..
 
  


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
Samba Folder does not show proper file size in windows Rustylinux Linux - Server 1 08-30-2007 11:18 AM
Installer has trouble making proper swap partition? General Debian 4 05-16-2007 08:27 PM
Why should you give the size of the swap disk as twice the size of RAM vmniza Linux - Newbie 3 09-17-2004 03:13 AM
Swap Size ajtaus Linux - General 3 12-19-2001 02:19 PM
Right size swap? jamaso Linux - Newbie 7 11-12-2001 01:12 AM


All times are GMT -5. The time now is 07:15 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration