Adding swap space in Linux
[root@ip-anurag grid]#
[root@ip-anurag grid]#
[root@ip-anurag grid]# free -g
total used free shared buff/cache available
Mem: 3 0 0 0 2 2
Swap: 0 0 0
[root@ip-anurag grid]#
[root@ip-anurag grid]# dd if=/dev/zero of=/swap_file bs=2G count=1
0+1 records in
0+1 records out
2147479552 bytes (2.1 GB) copied, 29.8424 s, 72.0 MB/s
[root@ip-anurag grid]# chmod 600 /swap_file
[root@ip-anurag grid]# mkswap /swap_file
Setting up swapspace version 1, size = 2097144 KiB
no label, UUID=9bd76b65-4abe-4ffb-a580-d4e9283daac2
[root@ip-anurag grid]#
[root@ip-anurag grid]# swapon /swap_file
[root@ip-anurag grid]#
[root@ip-anurag grid]# vi /etc/fstab
[root@ip-anurag grid]#
[root]# swapon --show
NAME TYPE SIZE USED PRIO
/swap_file file 2G 0B -2
[root@ip-10-0-1-12 ~]#
/swap_file swap swap defaults 0 0
[root@ip-anurag grid]#
[root@ip-anurag grid]# free -m
total used free shared buff/cache available
Mem: 3787 655 2274 16 857 2898
Swap: 2047 0 2047
[root@ip-anurag grid]#
[root@ip-anurag grid]#