關於Swap分區

Swap分區tip(摘自Redhat官方文檔)

Swap should equal 2x physical RAM for up to 2 GB of physical RAM, and then 1x physical RAM for any amount above 2 GB, but never less than 32 MB. 

Using this formula, a system with 2 GB of physical RAM would have 4 GB of swap, while one with 3 GB of physical RAM would have 5 GB of swap. Creating a large swap space partition can be especially helpful if you plan to upgrade your RAM at a later time. 

Tip      

If your partitioning scheme requires a swap partition that is larger than 2 GB, you should create an additional swap partition. For example, if you need 4 GB of swap, you should create two 2 GB swap partitions. If you have 4 GB of RAM, you should create three 2 GB swap partitions. Red Hat Enterprise Linux supports up to 32 swap files. 

For systems with really large amounts of RAM (more than 32 GB) you can likely get away with a smaller swap partition (around 1x, or less, of physical RAM). less

翻譯 :當物理內存小於2G時,swap大小爲物理內存的2倍。當物理內存大於2G,超過2G的部分,swap大小跟物理內存相等。
即:
    x<=2G的部分, swap=2x;
    x>2G的部分, swap= (2*2G)+( x-2G)
利用這個法則,2G物理內存須要4G swap,而3G物理內存則須要5G swap。若是你打算添加內存的話,建立一個大些的swap區是頗有幫助的。
Tip
若是按照分區計劃,你的swap區超過2GB,那麼應該建立另外的swap分區。
好比,你須要4GB的swap的分區,應該建立2個2GB的swap分區。

若是有4GB的物理內存,則應該建立3個2GB的swap分區。
Redhat EL支持多達32個swap文件。

分析:2GB的物理內存 須要swap 2x2GB=4GB,
超過2GB的2GB 須要swap 1x2GB=2GB。
總共6G,每一個swap分區2G,因此是3個2GB的swap分區

對於超過32G物理內存的,使用小於等於物理內存容量的swap區會更好。
相關文章
相關標籤/搜索