Skip to content

Instantly share code, notes, and snippets.

@akash-gajjar
Created March 27, 2024 08:22
Show Gist options
  • Save akash-gajjar/1da63157b992dc1f0defcb94402f4998 to your computer and use it in GitHub Desktop.
Save akash-gajjar/1da63157b992dc1f0defcb94402f4998 to your computer and use it in GitHub Desktop.
Increase swap size

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

  1. Create Swap file of 25GB
dd if=/dev/zero of=/swapfile1 bs=1024M count=25
  1. Format file as Swap
mkswap /swapfile1
  1. Change file permission
chmod 0600 /swapfile1
  1. Add swap in partition table by opening /etc/fstab and adding following entry
/swapfile1 none swap defaults 0 0
  1. Reload system configuration and activate the swap
systemctl daemon-reload
swapon /swapfile1

Finally open system monitor and verify swap size in resources tab.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment