Create Swap Space in Linux
[root@testdb1]# free
total used free shared buff/cache available
Mem: 1014976 81368 122336 12944 811272 734480
Swap: 0 0 0
[root@testdb1]# dd if=/dev/zero of=/swapfile bs=1024 count=1048576
1048576+0 records in
1048576+0 records out
1073741824 bytes (1.1 GB) copied, 13.2398 s, 81.1 MB/s
[root@testdb1]# ls -lh /swapfile
-rw-r--r--. 1 root root 1.0G May 8 10:05 /swapfile
[root@testdb1]# chmod 600 /swapfile
[root@testdb1]# ls -lh /swapfile
-rw-------. 1 root root 1.0G May 8 10:06 /swapfile
[root@testdb1]# mkswap /swapfile
Setting up swapspace version 1, size = 1048572 KiB
no label, UUID=ba9da34a-d07a-40a4-bd13-c869a982349a
[root@testdb1]# swapon /swapfile
[root@testdb1]# free
total used free shared buff/cache available
Mem: 1014976 77136 72720 12944 865120 746420
Swap: 1048572 0 1048572