Swap partition Swap
Recommended Size mem*2
Physical memory greater than 4G Swap=mem
In addition to the size of the swap space required by special software,
As long as the swap is frequent and data exchange occurs,
Then it means you're running out of memory.
When the system memory is low, the memory needs to be freed.
If the files in memory are not released,
Then you need to swap the in-memory files in the swap partition,
When the process calls the data again, recall the memory usage from the swap partition
Linux tends to use more memory to buffer
Creating a swap partition can be used: partitioning; Block file (DD)
01 dividing a physical partition/DEV/SDB5---2G
#fdisk/dev/sdb
t-->5-->82
#partx-A/dev/sdb
02 convert SDB5 into swap format (virtual memory paging)
#mkswap/DEV/SDB5
03 Viewing the current swap partition
#swapon-S
04 Start a new swap partition/DEV/SDB5
#swapon/DEV/SDB5
05 See Swapon-s again
06 Make sure the swap partition is automatically used for power on
#blkid
#vi/etc/fstab
uuid=****** swap swap Defaults,pri=1 0 0
The original swap space in the system, you can set these two swap partitions to
The same priority pri=? (0~32767)
The larger the number, the higher the priority,
The same priority, which is called parallel swap
* Parallel swap does not have any meaning on the same disk.
07 Restart tests whether a new swap partition is available.
#swapon-S
#free
-----------------------------
Use a block file as a swap partition
-----------------------------
#mkdir/swap
#dd If=/dev/zero of=/swap/swapfile bs=1m count=512
#mkswap/swap/swapfile
#swapon-P 1/swap/swapfile
#vi/etc/fstab
Create a swap partition manually