How to increase swap on RHEL 5
04 Aug 2009
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.
-
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).
-
Make it swap area. mkswap /var/swap512M
-
Remove unnecessary permissions. chmod 600 /var/swap512M
-
Enable file for swapping. swapon /var/swap512M
-
Check if file was enabled successfully. free -m or free -g
-
Add swap to filesystem table editing /etc/fstab and adding this line at the end: /var/swap512M swap swap defaults 0 0
Leave a reply