Linux add swap partition swap increases virtual memory

Source: Internet
Author: User

Amin Linux Learning notes swap partition

First, the role:

Swap partitions are swap partitions that swap with swap When the system is out of physical memory and have a significant impact on the performance of the Web Server by adjusting the swap partition size to improve server performance and save on resource costs.

Second, steps:

1. Create a swap file first

The command is as follows:

DD If=/dev/zero Of=/tmp/swap bs=1024k count=1000

650) this.width=650; "Width=" 692 "height=" "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ( "/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd; "alt=" Spacer.gif "/>

To view the current system memory:

free-m: ' - M ' is to display the results in theform of 'MB'

650) this.width=650; "Width=" 692 "height=" "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ( "/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd; "alt=" Spacer.gif "/>

2. format the swap file we created

Command:

Mkswap-f/tmp/swap

650) this.width=650, "width=" 692 "height=" "src=", "/e/u261/themes/default/images/spacer.gif", "style=" Background:url ( "/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd; "alt=" Spacer.gif "/>

3. Add virtual Memory

Swapon/tmp/swap

650) this.width=650; "Width=" 692 "height=" 121 "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd; "alt=" Spacer.gif "/>

The memory of the current swap partition has been increased by 1000MBcomparedto 1899MB.

4. Uninstalling virtual Memory

Command:swapoff/tmp/swap

650) this.width=650; "Width=" 692 "height=" 134 "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd; "alt=" Spacer.gif "/>

OK Now after uninstalling, see only 899MB .


Linux add swap partition swap increases virtual memory

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.