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

3 Answers 3

up vote 9 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

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
1  
@Nils Please, refresh my memory. Since disk I/O goes through RAM, at what point has persistent storage (disk) ever been faster than volatile storage (RAM)? –  Michael Kjörling Aug 1 at 15:51
    
@Michael The possible transfer rate from disk exceeded that of the internal RAM throughput, but yes, in fact that was in result as fast as ram.... –  Nils Aug 3 at 6:21
1  
@Nils In my mind, it's pretty hard for disk I/O (shuffling data between disk and RAM) to ever be faster than RAM. –  Michael Kjörling Aug 3 at 12:50

Regarding Village's Bounty, all I can find is an archived mailing list post from August, 2011 stating that the preferred default before kernel commit r225076 was 32 GB, and up to 32 Slices for a Total of 1 TB of Ram (32^2 = 1024) After r225076 the limit per slice was removed, but the thread goes on to say that the practical limit should still be considered 1 TB, due to the limitation of size of a 32-bit integer. If you continue to read the thread, the commit as of August 23, 2011 changed the Size per Slice to 256 GB.

See The Nabble Archived Thread

share|improve this answer

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.