Lab environment:
There are two important reasons for creating a swap partition.
First, when the physical memory is insufficient to support system and application (process) operations, this swap space can be used as a temporary storage page for memory with low usage, allocate free memory to applications (processes) that are in urgent need.
Second, even if your machine has enough physical memory, some programs will transfer the paging content that is rarely used during their initialization to the swap space, in this way, physical memory space is provided. For applications (processes) with a probability of Memory leakage, the swap space is even more important, because no one wants to see the system crash due to insufficient physical memory.
Step 1: first divide a partition, for example, divide a primary partition from the second hard disk sdb, with the size of 1 GB.
The Administrator should develop a good habit, because this should be used as a swap partition, so the partition identifier is 82.
Use free-m to view the usage of the memory virtual memory swap.
Convert the sdb1 partition to the virtual memory swap and activate the virtual memory through swapong. Then we can see from free-m that the virtual memory has changed from 2 GB to 3 GB.
If you want this virtual memory to be used permanently, You need to modify/etc/fstab and write the virtual memory mounting information.
After modifying/etc/fstab, use swapon-a to re-read the virtual memory mounting information in the fstab file.
This article is from the blog of "the Linux open source technology blog", please be sure to keep this source http://dreamfire.blog.51cto.com/418026/1085693