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 run the dd command, for example, ddifdevzero.
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 run the dd command, for example:
Dd if =/dev/zero of =/home/swap bs = 1024 count = 512000
In this case, a partition file such as/home/swap will be created. the file size is 512000 blocks. generally, one block is 1 K, so the space here is 512 MB, then convert the partition into a swap partition.
/Sbin/mkswap/home/swap
Then use the swap partition to make it valid.
/Sbin/swapon/home/swap
Now we can 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 restarts, we find that swap is still as large as it was, the new swap is not automatically started and must be manually started. 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.