0

I'm using 2 GB RAM I've installed Ubuntu 14.04 LTS how much swap do I need to create?

1
  • 1
    Welcome to Ask Ubuntu! Please modify your question to add additional information.
    – Tim
    Jul 10, 2014 at 14:57

4 Answers 4

4

There is varying opinion on what the size of the swap should be - here are the Example Scenarios provided in the Ubuntu wiki:

RAM(MB) No hibernation  With Hibernation        Absolute maximum
 256     256              512                     512
 512     512             1024                    1024
1024    1024             2048                    2048

RAM(GB) No hibernation  With Hibernation        Absolute maximum
  1      1                2                       2
  2      1                3                       4
  3      2                5                       6
  4      2                6                       8
  5      2                7                      10
  6      2                8                      12
  8      3               11                      16
 12      3               15                      24
 16      4               20                      32
 24      5               29                      48
 32      6               38                      64
 64      8               72                     128
128     11              139                     256

Here also a table from the Fedora 64bit docs:

For <2GB, it recommends  the swap should be '3 times the amount of RAM' in size.

This mainly depends if you need want to hibernate or not - you need more as it saves the state of the system from the RAM to the swap.

Note swap may slow things down if swappiness is not configured correctly - you can read this question to find out how to do it.

If you need to increase the size of (or create) swap space, there are a few nice answers here.

1
1

For small RAM sizes like 1 or 2 or 3 GB its better to create a swap partition with double the size of RAM. eg: 4GB in your case. For rams higher like 8 GB swap partition of 2 GB will be sufficient.

11
  • 1
    Please see: askubuntu.com/questions/49109/… Personally i HAVE 2gb OF ram in this machine and 1GB of swap and have never run out. The double RAM Swap idea is a myth perpetuated by windows due to it's poor memory management. 'nix systems are much more RAM efficient. That being said a lot depends on what you are doing with the system. Video editing requires more ram than browsing the web, playing youtube videos and checking your email.
    – Elder Geek
    Jul 10, 2014 at 14:41
  • @Elder Geek- yes seems true but hibernation do requires high swap space.
    – Sudheer
    Jul 10, 2014 at 14:50
  • That's a good point. I never use it. I turn things off when I'm not using them.
    – Elder Geek
    Jul 10, 2014 at 14:58
  • @Elder Geek- what would be the minimum swap space for hibernation
    – Sudheer
    Jul 10, 2014 at 14:59
  • 1
    @Sudheer Not true, you can create a swap file on an existing partition.
    – fkraiem
    Jul 10, 2014 at 15:03
1

Personally I always make my swap 512 MB, just to have some wiggle room. If the OS starts using a lot of swap, you really need more RAM. (And if getting more RAM is not an option, then you can consider having more swap, it's better than nothing.)

0

4GB.

Without additional information we can't be specific, so I'm erring on the larger side: 4GB is probably more than you need, and disk space is cheap.

Not the answer you're looking for? Browse other questions tagged .