How to increase swap on RHEL 5

Perhaps, when you upgrade a system – buying new memory – you may need to increase swap too. You can do it in brief steps. We’ll add 512MB of swap in this example.

  1. Create file that would work as swap. dd if=/dev/zero of=/var/swap512M bs=1024 count=524288

    Parameter count requires size in kilobytes. 512 MB = 524 288 KB (512×1024).

  2. Make it swap area. mkswap /var/swap512M

  3. Remove unnecessary permissions. chmod 600 /var/swap512M

  4. Enable file for swapping. swapon /var/swap512M

  5. Check if file was enabled successfully. free -m or   free -g

  6. Add swap to filesystem table editing /etc/fstab and adding this line at the end: /var/swap512M    swap    swap     defaults 0 0

TrackBack URI | RSS feed for comments on this post


Leave a reply