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