Create a swap partition

SWAP (swap) is a partition on the hard disk divided in advance by a certain space, then the memory will be temporarily used data temporarily stored to the hard disk in order to free up physical memory space technology to make more active use of the Service , which is designed to solve the real physical memory shortage. In a production environment, the size of the partition exchange is generally 1.5 to 2 times the real physical memory.

 

If there is a good 3G formatted hard disk partition / dev / vdb2, we take him as a swap partition, follow these steps:

1. Format for the swap file systems: mkswap / dev / vdb2

2. Use the command swapon ready SWAP partition device mounted to the formal system. Prior to mount, using the free -m to view the swap memory of the system.

 

  Mount command: swapon / dev / vdb2 do not need to specify the mount directory

3. Use the free -m to view, you can see a significant increase in the size of the swap

 

4. In order to make the new swap partition after rebooting the device remains in effect, require the following format to write information to the configuration file, and remember to save,

vim / etc / fstab add the following: / dev / sdb2 the swap the swap Defaults 0 0

 

 

5.swapon -s can view the current usage of the swap

 

 6.swapoff / dev / vdb2 closed swap

 

 

 

Guess you like

Origin www.cnblogs.com/yuwensong/p/12453835.html