Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I remember for choice of swap partition, we should use (swap > 2xRAM) at least.Of course it deprecated , because max of computer's ram is very high. kernel support it.

My question: i remember each partition of swap just support 2G maximum, it means if you have 2G ram you should create 2 partition of 2G swap. Did kernel solve it ? it mean can i create 4G swap for one partition?

share|improve this question
    
Think: What happens to your system, if it starts to swap more than 2GB? Apart from that - can can create as many swap-partitions as you like. The priority-mount-option will tell the system to use it parallel or sequential. –  Nils Mar 2 '13 at 21:31
add comment

2 Answers

up vote 8 down vote accepted

Either you have a long memory or you've been reading obsolete documents. There used to be a 2GB swap size limit (on most 32-bit platforms), but this has not been the case for years. The limitation was removed at some point in the 2.2 kernel series.

The maximum useful size of a swap area depends on the architecture and the kernel version. It is roughly 2GiB on i386, PPC, m68k, ARM, 1GiB on sparc, 512MiB on mips, 128GiB on alpha and 3TiB on sparc64. For kernels after 2.3.3 there is no such limitation.

share|improve this answer
add comment

Swap is an area for "overflow" if something doesn't fit in RAM. You want not to use it ever (except for dire circumstances, or very unusual workloads) because disk is many, many times slower than RAM. So what you should do is to find out how variable your memory use is, configure memory so that only unlikely peak use doesn't fit, and configure swap with space for said peaks. In the above, the workload, what you consider "unlikely" enough to pay the price in performance, and how much breathing space to leave for extreme peaks is a delicate balancing act. So the standard rule of thumb of swap = twice RAM is total nonsense. On the other hand, disk is cheap, and unless you have hard data to the contrary, twice RAM will do fine ;-)

share|improve this answer
1  
...and that "rule of thumb" is really old: From times where 1 MB RAM was much and disk-IO was faster than direct RAM-throughput. –  Nils Mar 2 '13 at 21:33
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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