Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Possible Duplicate:
I have 16GB RAM. Do I need 32GB swap?

Since the late 90s I've always understood that it is best practice to allocate twice the amount of physical RAM as swap space.

I just received my new laptop in the mail and it came with 6GB of RAM. In a separate order I had 16GB of RAM to replace the preinstalled. I didn't have the right torx driver to get to the RAM in this machine, so I installed Ubuntu and manually set a 16GB partition for swap. 32GB seemed a tad excessive...

Did I make the right choice? Would my machine perform better if there was no SWAP at all?

share|improve this question

marked as duplicate by roadmr, izx, psusi, Uri Herrera, fossfreedom Jun 25 '12 at 9:46

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1 Answer 1

The main reason you need swap space is for hibernation; I've been told that if you hibernate, it needs to save everything to swap. I'm not sure if it always save the entire memory or just what's in use, but if you want to hibernate, you probably should have a bit more than the maximum RAM. Other than that, I never see swap used at all on my 4GB system, although it might get used if you do complex image editing with lots of layers and big images.

Depending on how big a drive you have, you can be "generous", and it's pretty easy to change later if needed. But I think 16GB is more than enough; I probably would have chosen 8 - 10.

According to the Ubuntu Swap FAQ, you should always have some swap space. It seems like it may be dated a bit, since it considers 2GB with a 100GB HD to be a high amount of RAM and a big drive, but it says swap should equal RAM in that case. My guess is that with larger amounts of RAM, you may be able to go lower, but it depends on what programs you use and how many, how long you system stays up, and whether you hibernate.

share|improve this answer
    
for hibernation you need the same size swap space as RAM, not sure if it does a complete(as in dd) copy or just what is in use but the system will not hibernate otherwise. I have 8GB ram and rarely use any swap, in fact not usually more than 25% of RAM so you could probably run with no swap perfectly . Lastly, in 12.04 hibernation is disabled by default.... –  TrailRider Jun 24 '12 at 3:10
1  
What if you already have swap space occupied when you go into hibernation? –  Dean Howell Jun 24 '12 at 12:21
    
You have made a good point there. Even though swap space doesn't seem to be used normally, if it is used, then you may need up to twice as much swap space as RAM. I've never seen this issue addressed, but I would think that the swap space would need to be as big as the RAM + any swap used, which is virtual RAM. –  Marty Fried Jun 24 '12 at 16:47

Not the answer you're looking for? Browse other questions tagged or ask your own question.