CentOS6.5 increase swap space and centos6.5 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: www.2cto.com divides a dedicated swap partition when installing the OS. The size of the SWAp partition must be planned in advance and automatically mount the partition 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 the swap space: the involved command: www.2cto.com free --- view the memory status command, which can 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 easy to mistakenly destroy, but it is not possible to put it in another directory; Option solution in the command Description: --- of: path and name of the output swap file; --- bs: block size, in bytes, usually 1 K, that is, 1024 bytes; --- count: the total number of blocks is the total size of the space, and the Unit is block (k). --- if: the Read Source Free Space. Why is it zero? It is not clear. please fix it first; 2. Set swapfile to swap space # mkswap swapfile3. Enable swap space. This operation is similar to the mount operation (for my personal understanding): # the operation of adding swap space to swapfile has ended, you can use the free command to check whether the swap space size has changed. 4. If you no longer use the space, you can disable the swap space. This operation is similar to the umount operation (for 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: (edit this Of course, vi is used ~) /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,