How much swap memory is enough?

Written by
Date: 2012-12-18 17:02:35 00:00

Your swap memory size

I have installed Linux systems since 1998, it was Red Hat Linux in those days, mostly Debian and Arch now a days, but when you are installing you still have to decide how big your swap memory should be?

What is swap memory?

In Linux, and in other Operating systems is the same, a swap file memory or partition is an extension of the real physical memory. The operating system (Linux in this case) will store in the disk segments of the physical memory that it is not being used at the time, to free memory for new applications that may need it.

Memory is very cheap today, and it is not difficult to have 8 GBytes of physical memory in any Desktop or even Laptop.

So, are you still need swap memory? Probably not, and almost sure not a swap memory size that doubles the physical memory as it was in the old days.

I think, if you have from 8 G Bytes or more, you do not really need swap memory at all, if you have from 4 G Bytes or less, maybe 1 Gigabyte of swap would be fine, 2 at the most. That applies for Desktops or servers.

If you are running a VPS with less than 1 Gigabyte or physical memory, you may want to equal the size of the swap to the size of your physical available memory.

If you are installing Linux on a laptop, you will have to equal the size of the swap memory to the physical memory in order to the be able to suspend to disk. When you suspend to disk all RAM is written in the swap area and then the power is turned off, if there is not enough space to allocate all physical memory in the swap memory the process will fail.

Consider those points next time you install Linux.