Last Updated on 3 months by Sachin G
Two important of swapping memory are as, first like when the system requires more memory than is statically available, the kernel swaps out less used pages and provides memory to the application and second the number of pages used application in the startup phase may only be used for initialization and not used again. The system swaps out pages and frees the memory for other resources. Here in this post, I am sharing about what Recommended swap size for Linux .
So many people use the old method that the swap partition should be twice the size of the system. In a current era that is a lot of swaps, most of the systems never swap. People don’t want their system to ever run out of memory ( RAM + SWAP) , but they usually would rather have enough RAM in the system so it doesn’t need to swap.
If we add a large amount of RAM to a system, we don’t need to extend a large amount of swap space.
Why do we need to swap the partition file system?
When physical memory ( RAM) is full, then the system needs more resources of memory. The swap will be used when the amount of physical memory is full then inactive pages in memory are moved to the swap filesystem.
The amount of swap memory recommended for Linux depends on some factors including the amount of memory in the system and the workload on the memory.
Recommended swap size for Linux
2GB of RAM requires 2 times the amount of RAM
2GB-8GB RAM requires Equal to the amount of RAM
8GB to 64GB of RAM requires 0.5 times the amount of RAM
64GB of RAM requires 4 GB of swap space
Recommended swap space if allowing for hibernation
2GB of RAM requires 3 times the amount of RAM
2GB-8GB RAM requires 2 times the amount of RAM
8GB to 64GB of RAM requires 1.5 times the amount of RAM
64GB of RAM requires No extra space needed
I am a professional freelance contributor and the founder of Tech Transit. I hold certifications in Linux, Ansible, and OpenShift from Red Hat, as well as CPanel and ITIL certifications. With a passion for education, culture, and community, I love writing and sharing knowledge. Since 2009, I’ve been actively using, setting up, supporting, and maintaining Linux systems. Linux truly rocks!