Partition Rules for swap in linux

Source: Internet
Author: User

Swap partition, that is, swap zone. The role of swap space can be simply described as: when the physical memory of the system is insufficient, a part of the physical memory needs to be released, for the currently running program. The released space may come from some programs that haven't been operated for a long time. The released space is temporarily saved to the Swap space and will be executed by those programs, then, the stored data is restored from Swap to the memory.

In this way, the system always performs Swap switching when the physical memory is insufficient. In fact, Swap adjustment is crucial to the performance of Linux servers, especially Web servers. By adjusting Swap, the system performance bottleneck is sometimes crossed to save system upgrade costs.

When the physical memory is less than 2 GB, the size of the swap partition is twice that of the physical memory. For a part larger than 2 GB, the swap partition size is equal to the physical memory size.

That is, the following formula is obtained:

X <= 2g, y = 2x
X> 2G, y = x

Using this formula, 2G physical memory requires 4G swap, while 3G physical memory requires 5G swap. If you want to add memory, it is helpful to create a larger swap zone.

For example, if your swap partition exceeds 2 GB according to the partition plan, you should create another swap partition. For example, if you need a 4G swap partition, you should create two 2G swap partitions.

If there is 4 GB physical memory, 6 GB swap partition is required according to the formula:

2x2 GB = 4G 1x2 GB = 2G the sum of the above two. 6 GB in total)

Each swap partition is 2 GB. Create 3 2G swap partitions.

Redhat EL supports up to 32 swap files.

For more than 32 GB physical memory, it is better to use a swap partition smaller than or equal to the physical memory capacity.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.