Although the current memory is very low, reasonable planning of swap partitions can greatly improve the stability of system operation. The following describes the settings of swap partitions! [Root @ localhost ~] # Ddifdevzeroofdataswapfilebs1Mcount1010 + 0recordsin10 + 0recordsout10485760bytes (10 M
Although the current memory is very low, reasonable planning of swap partitions can greatly improve the stability of system operation. The following describes the settings of swap partitions!
[Root @ localhost ~] #DdIf =/dev/zero of =/data/swapFileBs = 1 M count = 10
10 + 0 records in
10 + 0 records out
10485760 bytes (10 MB) copiEd, 0.143459 seconds, 73.1 MB/s
[Root @ localhost ~] #Mkswap/Data/swapfile
Setting up swapspace version 1, size = 10481 kB
[Root @ localhost ~] #Free
Total uSedFree shared buffers cached
Mem: 444416 294176 150240 0 18432 198928
-/+ Buffers/cache: 76816 367600
Swap: 1048568 0 1048568
[Root @ localhost ~] #Swapon/Data/swapfile
[Root @ localhost ~] # Free
Total used free shared buffers cached
Mem: 444416 294176 150240 0 18448 198928
-/+ Buffers/cache: 76800 367616
Swap: 1058800 0 1058800
[Root @ localhost ~] #Swapoff/Data/swapfile
[Root @ localhost ~] # Free
Total used free shared buffers cached
Mem: 444416 294176 150240 0 18472 198928
-/+ Buffers/cache: 76776 367640
Swap: 1048568 0 1048568
This is the operation related to swap. However, if you want to restart the system, you still need to modify/etc/fastab to add the following statement.
/Data/swapfile none swap sw 0 0
Conclusion: This operation aims to understand the settings of swap.