Linux - GeneralThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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...
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.
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
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.
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
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.
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.
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.
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=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
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...
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.)
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.