Origin of the rule that swap size should be 2x of the physical memory
Hacker News
February 25, 2026
AI-Generated Deep Dive Summary
The recommendation to set swap space equal to twice the physical memory is often cited but not a strict rule. Originating from older systems like SunOS 4, this guideline was based on the need for contiguous disk space allocation to handle system paging efficiently, especially when dealing with limited RAM and hard disk drives (HDDs) that had slower seek times.
In the past, systems relied heavily on swap because physical memory was scarce. For example, in 1997, a machine with 8 MB of RAM might have 320 MB of disk space, creating a ratio where swap size could be significantly larger relative to RAM. This ratio made sense due to the way paging worked—allocating contiguous blocks on disks for swapping memory pages. However, modern systems, especially those using SSDs and facing larger RAM sizes, often do not require such a large swap allocation.
The rationale behind this rule was both technological and psychological. Technologically, it ensured that there was always enough free space to write out entire memory ranges without fragmentation issues. Psychologically, it provided sysadmins with a simple rule of thumb to follow, even if it wasn’t always strictly necessary. Today, while the 2x guideline remains useful for certain scenarios, especially in environments where disk space is limited or where legacy systems are still in use, modern hardware and improved memory management techniques often make such rigid rules less relevant.
Understanding this history matters for tech enthusiasts and sysadmins who work with older systems or aim to optimize modern ones. It highlights the evolution of storage and memory technologies, emphasizing how practices from the past may no longer apply in the same way today. By appreciating these nuances, professionals can make more informed decisions about system configuration and resource allocation, balancing performance needs with available hardware capabilities.
Verticals
techstartups
Originally published on Hacker News on 2/25/2026