Presently my RAM is 2GB. I heard that in linux we can get extra memory to RAM from the harddisk by using swap partition. What is the procedure for that?

enter image description here here in the pics i'm giving my system info.

enter image description here

  • The swap partition is not meant to act as RAM, since any memory stored on the hard disk is very slow. However, it is necessary to have a swap partition in case the RAM overflows. That way, it would catch the overflowed RAM, preventing a crash. – Dillmo Jan 24 '14 at 11:56
  • The guys below answered your question. I just want to suggest you to don't use a 64 bit system with only 2GB RAM. It is inefficient with that few RAM, stick with a 32 bit OS and you will have more free RAM. – falconer Jan 24 '14 at 11:59
  • 1
    You already have a swap partition as one is set up by the installer, and you see it shown by swapon -s. – psusi Jan 24 '14 at 14:45

In a default Ubuntu installation you will always have a swap partition which will be created by the installer. In your setup it is the partition /sda5 but this location may change from system to system.

This partition will obviously not be able to increase the physical RAM but it is storage memory on your hard disk reserved for the kernel to use whenever we run short of physical RAM. This may never happen on a system with 2 GB of RAM unless we perform very memory demanding tasks (e.g. video processing, huge image processing) or have many applications running simultaneously.

Note that memory usage on swap is extremely slow, so we do not really want to have that other than in emergency situations.

In case you need a larger swap you can do so after installation either by creating a larger swap partition:

or by adding a swap on a file (which can not be used for hibernation):

More about swap can also be found here:


You've piece of (hardware) RAM of 2GB and you can't 'create' more RAM with software. But I think I know what you've heard of.

From Linux.com

When the system requires more memory than is physically available, the kernel swaps out less used pages and gives memory to the current application (process) that needs the memory immediately.

So when you have a SWAP space that is twice as big as your memory (in your case a swap space of 4 GB) your system will be able to putt the entire memory on swap space, and read the other 2 GB in on the memory. In other words, it is able to swap the entire content of your memory with the 2GB data on the swap disk.

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