If SWaP space is used up, an error occurs. Therefore, we need to make a correct partition of the SWaP space when installing the system, and know how to increase the SWaP space when the Swap space is reduced. Here, we will briefly introduce how to increase the Swap space through the SWaP file to save your effort.
1) become a Super User
$ Su-root
2) create a Swap file
# Dd if =/dev/zero of = swapfile bs = 1024 count = 65536
Create a swap file with continuous space.
3) activate the Swap file
#/Usr/sbin/swapon swapfile
Swapfile refers to the swap file created in the previous step.
4) now the newly added Swap file has taken effect, but after the system restarts, it does not remember the previous steps. Therefore, you must record the file name and Swap type in the/etc/fstab file, for example,/path/swapfile none Swap sw, pri = 3 0 0
5) check whether the Swap file is added
/Usr/sbin/swapon-s
Delete excess Swap space
1) become a Super User
2) use the Swapoff command to reclaim Swap space.
#/Usr/sbin/swapoff swapfile
3) edit the/etc/fstab file and remove the entity of the Swap file.
4) reclaim the file from the file system.
# Rm swapfile
5) Of course, if the Swap space is not a Swap file but a partition, you need to create a new file system and then mount it to the original file system.