If swap space is insufficient, how can I manually add swap space? The following operations must be performed under the root user:
First, create a partition and use the DD command, such
Dd If =/dev/Zero of =/home/swap BS = 1024 COUNT = 512000
This will create a partition file such as/home/swap. The file size is 512000 blocks. Generally, 1 block is 1 K, so the space is 512 MB. Then convert the partition into a swap partition.
/Sbin/mkswap/home/swap
Then use the swap partition. Make it valid.
/Sbin/Swapon/home/swap
Now, run the free-M command to check the memory and swap partition size, and we can see that the space is increased by MB. However, after the computer is restarted, it is found that swap is still so large, the new swap is not automatically started, and manual start is required. Modify the/etc/fstab file and add the following line:
/Home/swap defaults 0 0
You will find that swap space increases after your machine is automatically started.