A rapid increase in the use of swap space document
1, using dd create swapfile, bs units of bytes, the unit may be manually designated as M or G, count is the count, increase examples 1M * 1024 = 1G space
[root@ecs-3642 /]# dd if=/dev/zero of=swapfile bs=1M count=1024
1024+0 records in
1024+0 records out
1073741824 bytes (1.1 GB) copied, 5.32039 s, 202 MB/s
2, mkswap swap file is created
[root@ecs-3642 /]# mkswap swapfile
Setting up swapspace version 1, size = 1048572 KiB
no label, UUID=5b0141c1-5bbc-4f44-8d31-80a9cf160b36
3, swapon to activate
[root@ecs-3642 /]# swapon swapfile
swapon: /swapfile: insecure permissions 0644, 0600 suggested.
4, see how increasing the swap space
[root@ecs-3642 /]# free -h
total used free shared buff/cache available
Mem: 991M 568M 68M 50M 354M 222M
Swap: 1.0G 0B 1.0G
5, boot
vim /etc/fstab 添加
/swap/swapfile swap swapdefaults 0 0
6, get rid increase swap
stop using swap
swapoff swapfile
Delete Files
rm swapfile -rf
confirm
free -h