Installing Linux requires two partitions, one is the root directory, and the other is swap (memory swap space). The function of swap is the function of memory expansion record due to insufficient physical memory. In general, if the hardware is adequately equipped, then swap should not be used by our system.
The data that the CPU reads comes from memory, when the memory is not enough, in order to let the subsequent program can run smoothly, so the program and data that is temporarily not used in memory will be moved to swap. The memory is now empty to load the program that needs to be executed. Swap uses a hard disk to temporarily place the information in memory.
The current host memory is very large, so in personal use, do not set swap is not a big problem. However, the server can be different, hesitate does not know when there will be a large number of requests from the network, so it is best to reserve some swap to buffer the system's memory usage.
How to create a new swap partition:
1, Partition: First use FDISK to separate a partition on the disk for the system as swap. Because the Linux fdisk defaults to set the partition's ID to the Linux file system, you may have to set the system ID.
2, Format: Using the new swap format "Mkswap device file name" to be able to format the partition into swap format.
3, use: Finally the swap device is started, the method is "Swapon device file name."
4, view: Finally through the free This command to check the memory usage.
(the basic Study (third edition) of "Brother Bird's Linux private cuisine") 8.5 reading notes)