linux 关于 swap分区的划分规则
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 , while one with 3 GB of physical RAM would have 5 GB of . 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).
大概的意思是:
当物理内存小于2G时,swap大小为物理内存的2倍。超过2G的部分,swap大小跟物理内存相等。
也即是,得到如下公式:
x<= 2G的部分, y=2x
x>2G 的部分, y=x
利用这个公式,2G物理内存需要4G swap,而3G物理内存则需要5G swap。如果你打算添加内存的话,创建一个大些的swap区是很有帮助的。
举个例子:如果按照计划,你的swap区超过2G,那么应该创建另外的swap。比如,你需要4G的swap的分区,应该创建2个2G的swap分区。
如果有4G的物理内存,就要6G的swap(根据公式:
2x2GB=4G 1x2GB=2G 上述2个之和。一共6G)
每个swap分区2G。则应该创建3个2G的swap分区。
Redhat EL支持多达32个swap文件。
对于超过32G物理内存的,使用小于等于物理内存容量的swap区会更好。
- 最新评论