CENTOS6.5 increase swap space

Source: Internet
Author: User

CENTOS6.5 increase swap space
When installing Oracle 11g on CentOS 6.5, the system prompts that the swap space is insufficient. Baidu has come to find a way to increase the swap space. There are two ways to increase the swap space: strictly speaking, after the system is installed, there is only one method to add swap, which is the second method in this article. The first method should be to set the swap zone when installing the system. 1. Partition: a dedicated swap partition is created when the OS is installed. The size of the SWAp partition must be planned in advance and automatically mounted when the system is started. This method can only be set during OS installation. Once set, it is difficult to change unless you reinstall the system.
2. Use swapfile: (or the entire idle partition) to create a temporary swapfile or an idle partition. Set it to swap space as needed. A maximum of 8 swapfiles can be added. The swap space is closely related to the CPU. In the i386 system, a maximum of 2 GB space can be used. Increase or decrease the total capacity of 2 GB after the system is started. This method is flexible and convenient. The disadvantage is that it needs to be set manually after the system is started. The following describes how to use swapfile to increase swap space: the involved command: free --- view memory status command to display the size and usage of memory, swap, buffer cache, and so on; dd --- read, command to convert and output data; mkswap --- set the swap zone swapon --- enable the swap zone, equivalent to mountswapoff --- disable the swap zone, equivalent to umount step: 1. Create swapfile: root permission, create swapfile, if the current directory is "/", run the following command: # dd if =/dev/zero of = swapfile bs = 1024 count = 500000 then a swapfile is created under the root directory, the name is "swapfile" and the size is 500 mb. You can also output the file to any directory you want. In my opinion, it is better to directly store the file in the root directory, it is not prone to accidental damage. If it is placed in another directory, it will not; the option in the command is: --- of: the path of the output swap file and Name; --- bs: block size. Unit: byte. Generally, 1 k means 1024 bytes. --- count: Total block size, that is, the total space size. Unit: block, that is, k. --- if: why is the source free space read zero? I don't know why. Write it like this. 2. Set swapfile to swap space # mkswap swapfile3. Enable swap space, this operation is a bit similar to the mount operation (my personal understanding): # The swapon swapfile operation is now complete to increase the swap space. You can run the free command to check whether the size of the swap space has changed; 4. if you no longer use the space, you can disable the swap space. This operation is similar to the umount operation (my personal understanding ):: # swapoff swapfile This method requires you to manually set and enable swapfile every time the system is started. It is troublesome. Solution: in/etc/rc. d/rc. add the following content to the last line of the local file: (you must use vi to edit the file ~) /Sbin/swapon/swapfile is saved and exited. After the system is started, the swap space is automatically loaded. Conclusion: You must plan the swap size when installing the OS, it is usually twice the memory size, but you need to consider the possibility of increasing the memory size in the future, so you can consider setting a slightly larger value,

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.