Adjust the swap partition size-linux install Oracle times swap Not enough solution

Source: Internet
Author: User

Resizing swap partitions

Method One: If the disk has the remaining space, use the partition tool to create a new swap partition. and write to/etc/fstab inside.
Again #swapon-A
Method Two: You can use a file to do the swap partition.

Su Root

CD/

Mkdir/swap


1, the establishment of swap files, such as in/TMP under the establishment of Swapfree as a swap file. Establish
#dd If=/dev/zero f=swapfree bs=32k count=8192
(bs=32k specifies that each sector consumes 32kb, reads into 8192+0 sections, and outputs 8192+0 segments)
Note: The purpose of the BS parameter is to specify how many bytes per read and input, and because the smallest unit of disk access is sector, setting BS is also equal to the size of each sector, while the purpose of count is to specify how many sectors can be used. Therefore, the amount of hard disk space that can be used is equal to bs* Count. For example, the hard disk space that you can use is equal to 32*8192=262144 (KB), which is also equal to 256MB. )
After executing the above command, a 256MB swapfree file is created in the/tmp directory
2. Format China and start swap file
Next, execute the mkswap command, format the Myswap file into the S file system, which the system can use, switch to the/tmp directory, and execute the following command:
# Mkswap Swapfree (#将文件格式化为swap文件格式)
Setting up Swapspace version 1, size = 262144 KB
# Swapon/tmp/swapfree (#启动swap分区)
To stop using the newly created swap file, simply execute the swapoff/tmp/swapfree command and delete the swap file if it is no longer in use.
3. Check Swap
#swapon-S
4. Automatically start the newly added swap partition when booting
If you have to execute the swapon command to start the swap partition or file after each boot, it's too much trouble. You can use the text editor to add a line to the/etc/fstab file, so that the swap partition and file will be started automatically when you start it:
/DEC/HDB5 swap swap defaults 0 0 (start this swap partition at boot time)
/tmp/swapfree swap swap defaults 0 0 (start this swap file at boot).
Swap space Size:
Typically, the swap space should be greater than or equal to the size of the physical memory, the minimum should not be less than 64M, usually the size of the swap space should be 2-2 of physical memory. 5 times times. However, depending on the application, there should be different configurations: if it is a small desktop system, you only need a small swap space, while the large server system requires different sizes of swap space depending on the situation. In particular, the database server and Web server, with the increase in traffic, the swap space requirements will also increase, the specific configuration see the description of the server products.
Swap quantity:
The number of swap partitions also has a significant impact on performance. Because swap operations are disk IO operations, if there are multiple swap zones, the swap space is allocated in a rotating manner to all swaps, which greatly balances the IO load and speeds up swap. If there is only one swap area, all switching operations will make the swap area very busy, leaving the system most of the time in a waiting state and inefficient. With the performance monitoring tool you will find that the CPU is not very busy at this time, but the system is slow. This shows that the bottleneck on the IO, relying on the speed of the CPU can not solve the problem.

Root User under
1, the file system to increase (the following is to increase the 512M file system for example)
DD If=/dev/zero of=/home/oracle/myswaps/swapfile1 bs=1m count=512
Note: The After path must not be in/dev or the Times parameter in the active swap file is invalid
2. Create swap file
Mkswap/home/oracle/myswaps/swapfile1
3. Activating swap Files
Swapon/home/oracle/myswaps/swapfile1
4, at this time with FREE-M can see the swap space has increased, but after the restart will not exist
5, add the restart will also take effect, Vi/etc/fstab add the following:
/home/oracle/myswaps/swapfile1 swap swap defaults 0 0

Adjust the swap partition size-linux install Oracle times swap Not enough solution

Related Article

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.