The Notebook Review forums were hosted by TechTarget, who shut down them down on January 31, 2022. This static read-only archive was pulled by NBR forum users between January 20 and January 31, 2022, in an effort to make sure that the valuable technical information that had been posted on the forums is preserved. For current discussions, many NBR forum users moved over to NotebookTalk.net after the shutdown.
Problems? See this thread at archive.org.

    The Age old question: How big to make my SWAP partition?

    Discussion in 'Linux Compatibility and Software' started by The Fire Snake, Aug 5, 2008.

  1. The Fire Snake

    The Fire Snake Notebook Virtuoso

    Reputations:
    426
    Messages:
    2,889
    Likes Received:
    0
    Trophy Points:
    55
    I have always used the rule of thumb to make SWAP double the size of the amount of memory you have. This was in the days when 512MB of memory was considered a lot. In fact my SWAP partition on my desktop is 2GB since I have 1GB of memory.

    So my question is my laptop has 4GB of memory, which is a lot. Would it be wise to make a 8GB SWAP partition? It sounds really big to me. What rule of thumb should I follow now?

    Thanks.
     
  2. aespinalc

    aespinalc Notebook Evangelist

    Reputations:
    45
    Messages:
    303
    Likes Received:
    0
    Trophy Points:
    30
    i had same question long ago... a teacher of OS told me that for 2gb it was practically unnecessary to add the swap...
    do the maths ;)
     
  3. josher

    josher Notebook Guru

    Reputations:
    2
    Messages:
    59
    Likes Received:
    0
    Trophy Points:
    15
    I usually let windows manage mine.
     
  4. aespinalc

    aespinalc Notebook Evangelist

    Reputations:
    45
    Messages:
    303
    Likes Received:
    0
    Trophy Points:
    30
    not windows, linux ^^
     
  5. synic

    synic Notebook Deity

    Reputations:
    131
    Messages:
    849
    Likes Received:
    0
    Trophy Points:
    30
    1-2 gigs.

    (10char)
     
  6. jas

    jas Notebook Evangelist

    Reputations:
    697
    Messages:
    622
    Likes Received:
    5
    Trophy Points:
    31
    My opinion (what else), which is mirrored in Ubuntu's Swap Partition FAQ, is that not only should you definitely have a swap partition, but that it should be, at the minimum, equal to the amount of RAM you have installed, for systems where you have at least 2gb of RAM. The main reason for that is that even though you may have enough RAM where your system will likely not need to swap to disk, if you want to hibernate, you will need a swap partition as big as your RAM. If you have less than 2gb of RAM installed, then my recommendation would be that you can use the old rule of thumb of twice the amount of RAM installed.

    Good Luck..
     
  7. Bog

    Bog Losing it...

    Reputations:
    4,018
    Messages:
    6,046
    Likes Received:
    7
    Trophy Points:
    206
    Allocate 2GB for the swap; however, later on you can control how much the kernel swaps with the vm.swappiness feature. Just Google it and you'll find out what I'm referring to.

    I have 2GB of RAM in my ThinkPad T42 and I have set the kernel to not swap at all (swappiness=0). The system is just as stable with no performance hit whatsoever.
     
  8. theZoid

    theZoid Notebook Savant

    Reputations:
    1,338
    Messages:
    5,202
    Likes Received:
    22
    Trophy Points:
    206
    2 gigs.....is what I have. My system ram is 3 gigs, and it uses swap on large file transfers to my external HD.
     
  9. Thomas

    Thomas McLovin

    Reputations:
    1,988
    Messages:
    5,253
    Likes Received:
    0
    Trophy Points:
    205
    256MB to 1GB is suffeciant for me.
     
  10. D-EJ915

    D-EJ915 Notebook Consultant

    Reputations:
    123
    Messages:
    161
    Likes Received:
    0
    Trophy Points:
    30
    I don't have one, but then again I have 2GB of ram and never suspend or hibernate.
     
  11. flipfire

    flipfire Moderately Boss

    Reputations:
    6,156
    Messages:
    11,214
    Likes Received:
    68
    Trophy Points:
    466
    I have 4gb RAM and made the swap file partition to 4gb
     
  12. Ethyriel

    Ethyriel Notebook Deity

    Reputations:
    207
    Messages:
    1,531
    Likes Received:
    0
    Trophy Points:
    55
    If you compress the image when you hibernate, you only need 1/2 the RAM. For pure swap usage, with 4GB, I'd use no swap, but no more than 512MB for normal desktop use. On the other hand, for some uses 4GB might not be much memory, so you need more swap.
     
  13. zephyrus17

    zephyrus17 Notebook Deity

    Reputations:
    646
    Messages:
    1,576
    Likes Received:
    0
    Trophy Points:
    55
    I always have swap=RAM. That's since I have 2Gb. Then again, I don't really see a reason to have 4Gb of RAM. Most computers hardly use over 2Gb in the first place.

    But for RAM <2Gb, I'd recommend 2 times the swap.

    Swap size is only really important if you Hibernate or Standby often. Because the data, in these cases, are saved into the swap, not RAM.
     
  14. ivar

    ivar Notebook Deity

    Reputations:
    432
    Messages:
    1,410
    Likes Received:
    0
    Trophy Points:
    55
    In the age of big and cheap RAM, the only purpose of SWAP is to let you hibernate your laptop . So, you need SWAP partition of the size slightly bigger than your RAM.
     
  15. archer7

    archer7 Notebook Evangelist

    Reputations:
    289
    Messages:
    647
    Likes Received:
    0
    Trophy Points:
    30
    Just to clarify, the term "Standby" often refers to suspending to ram, rather than suspending to disk.
     
  16. zephyrus17

    zephyrus17 Notebook Deity

    Reputations:
    646
    Messages:
    1,576
    Likes Received:
    0
    Trophy Points:
    55
    Ahh.. I see. You learn something new everyday. :)
     
  17. The Fire Snake

    The Fire Snake Notebook Virtuoso

    Reputations:
    426
    Messages:
    2,889
    Likes Received:
    0
    Trophy Points:
    55
    Ok, thanks for all the replys. I am still confused though. I will definitely have some swap space. So it looks like, from your comments, that I will need a swap space equal to or slightly larger than my RAM if I want to hibernate.

    So basically I can get away with 2 GB of SWAP space if I don't Hibernate?
    What about if I want to put the laptop to sleep, how big of a swap space is needed?
    What happens if you run out of swap space, major crash :( ?
     
  18. archer7

    archer7 Notebook Evangelist

    Reputations:
    289
    Messages:
    647
    Likes Received:
    0
    Trophy Points:
    30
    I have 1 gig of ram, and I've never had to use swap space, even while running a resource-heavy DE. So yes, you could get away with using less swap than your ram if you never Hibernate.

    I don't think you will need any swap space to go into Sleep Mode (a.k.a Standby or Suspend to RAM); you have more than enough RAM.

    Before you can run out of swap, you first have to run out of ram, and I can't imagine your doing anything with linux that will require more than 2 gigs of ram (barring major hypervisoring); so you shouldn't be worried.
     
  19. The Fire Snake

    The Fire Snake Notebook Virtuoso

    Reputations:
    426
    Messages:
    2,889
    Likes Received:
    0
    Trophy Points:
    55
    Ok, Thanks to all for the great input!

    So here is what I have decided(not sure if it would help others in the same dilemma)

    I will be putting Kubuntu 8.04 on my Thinkpad T61p in the next couple of days. I am going to probably use 1 GB of SWAP space. I want to use some, just to be safe. Since I have 4GB of RAM I don't think I will use swap space much for normal tasks(not going to do much intensive work) and even if I use some SWAP I will have 1GB.

    I went to thinkwiki and found out that hibernate doesn't even work in Ubuntu 8.04, so I won't use that then and I don't need the 4+ GB of SWAP space for that. I will use sleep one in a while, and since that saves to RAM I should be fine.
     
  20. x00n

    x00n Notebook Geek

    Reputations:
    2
    Messages:
    79
    Likes Received:
    0
    Trophy Points:
    15
    depend on the purpose, 512 i stick to. my server has 1gb ram, and i don't see it needs 2gb swap, so 512 is just in case it needs it.
     
  21. zephyrus17

    zephyrus17 Notebook Deity

    Reputations:
    646
    Messages:
    1,576
    Likes Received:
    0
    Trophy Points:
    55
    Yeah. With 4Gb of RAM, you only need, if you don't hibernate, probably 512 or even 256Mb RAM. You system will very very very very rarely even hit 3Gb RAM in the first place.
     
  22. The Fire Snake

    The Fire Snake Notebook Virtuoso

    Reputations:
    426
    Messages:
    2,889
    Likes Received:
    0
    Trophy Points:
    55
    Even with a 64 bit version of the distribution?
     
  23. zephyrus17

    zephyrus17 Notebook Deity

    Reputations:
    646
    Messages:
    1,576
    Likes Received:
    0
    Trophy Points:
    55
    Yeap. I have the 64-bit version. I've not even hit my max of 2Gb yet.
     
  24. bulletprooflama

    bulletprooflama Notebook Guru

    Reputations:
    2
    Messages:
    74
    Likes Received:
    0
    Trophy Points:
    15
    I have 2 Gigs RAM and I've set my swap partition to 512 MB, just i case I need to use it (never used more than 32 MB till date). I never hibernate and I've set the swappiness to 0 (someone else has mentioned this before). This controls how often the swap file should be used, and 0 basically means never. And this is running ubuntu 64-bit.
     
  25. zephyrus17

    zephyrus17 Notebook Deity

    Reputations:
    646
    Messages:
    1,576
    Likes Received:
    0
    Trophy Points:
    55
    "swappiness"? How do you change that?
     
  26. Pitabred

    Pitabred Linux geek con rat flail!

    Reputations:
    3,300
    Messages:
    7,115
    Likes Received:
    3
    Trophy Points:
    206
    If you aren't going to hibernate, I wouldn't even put in a swap partition. There's pretty much no reason for it under Linux with 4GB of RAM. My HD media player machine doesn't even use up it's 2GB of RAM except for file caching of the media files.

    The only reason you would want swap is if you had some heavy-weight apps that you used. I have 3GB of RAM in my T61, and I also have 3GB of swap. Of that, while running some serious enterprise-level Java data processing apps, and opening and parsing a 90MB XML file, I have used 280MB of my swap. After closing the apps, I have 1.5GB of free RAM. If you want swap at a later date, or even just temporarily for a big job, you can just create a big file, and use it for swap. Or even just plug in a USB thumb drive and use THAT as swap. Try "man swapon" at a console. You can rearrange your swap usage on the fly.
     
  27. The Fire Snake

    The Fire Snake Notebook Virtuoso

    Reputations:
    426
    Messages:
    2,889
    Likes Received:
    0
    Trophy Points:
    55
    Cool, thanks Pitabread. Some really good info here, some I never heard about before. For now, like I said, I just did 1 GB of swap and I wasn't real tight on HD space. Maybe next time when I do an upgrade and format partitions, I will just reclaim that space for my OS or data partition. I would like to maybe have hibernate as an option but it doesn't work on Ubuntu 8.04(at least thats what thinkwiki says).


    +1 rep
     
  28. zephyrus17

    zephyrus17 Notebook Deity

    Reputations:
    646
    Messages:
    1,576
    Likes Received:
    0
    Trophy Points:
    55
    I have hibernate with my T61p..
     
  29. The Fire Snake

    The Fire Snake Notebook Virtuoso

    Reputations:
    426
    Messages:
    2,889
    Likes Received:
    0
    Trophy Points:
    55
    Hmm, thats strange. Here is what Thinkwiki says...

     
  30. archer7

    archer7 Notebook Evangelist

    Reputations:
    289
    Messages:
    647
    Likes Received:
    0
    Trophy Points:
    30
    That's probably outdated data. When it comes to wikis, you shouldn't believe anything that comes from a single source. I'm almost certain that I've seen the T61 under the compatibility list for uswsusp.

    Also, the T61 is linux certified under Novell, and Red Hat also I believe.
     
  31. Pitabred

    Pitabred Linux geek con rat flail!

    Reputations:
    3,300
    Messages:
    7,115
    Likes Received:
    3
    Trophy Points:
    206
    My T61 will hibernate (Kubuntu 8.04, 64bit, 3GB RAM). It does some funky graphical stuff when waking back up, and I generally just don't do it because it takes about as long to hibernate as it does to just boot normally. But it does work.