Redhat recommends swap should be at-least 1.5-2x size of available ram. Having low swap can result in degraded system performance when ram usage is high, to further increase the swap size we can take below steps
Below commands should be executed as root
- Create Swap file of 25GB
dd if=/dev/zero of=/swapfile1 bs=1024M count=25
- Format file as Swap
mkswap /swapfile1
- Change file permission
chmod 0600 /swapfile1
- Add swap in partition table by opening
/etc/fstab
and adding following entry
/swapfile1 none swap defaults 0 0
- Reload system configuration and activate the swap
systemctl daemon-reload
swapon /swapfile1
Finally open system monitor and verify swap size in resources tab.