Linux的Swap空间需要设置多大?

我们看看redhat的官方答复是怎么说的:

Amount of RAM in the system 物理内存Recommended swap space建议的交换空间大小Recommended swap space if allowing for hibernation如果开启休眠功能建议的交换空间大小
⩽ 2GB2 times the amount of RAM3 times the amount of RAM
> 2GB – 8GBEqual to the amount of RAM2 times the amount of RAM
> 8GB – 64GBAt least 4 GB1.5 times the amount of RAM
> 64GBAt least 4 GBHibernation not recommended

总结起来就是,如果不打算开启休眠功能,物理内存在8G以下,则swap设置为与物理内存一样大。如果物理内存在8G以上,swap空间设置为8G即可。当物理内存大于64G时,不建议开启休眠功能。

以下是Ubuntu的指南,更加细致:(从左至右依次是RAM大小,不开启休眠,开启休眠,最大值)

参考链接如下:
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/installation_guide/s2-diskpartrecommend-ppc#id4394007

https://help.ubuntu.com/community/SwapFaq

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注