Tuesday, March 15, 2011

Increasing SWAP space on Red Hat Linux

The commands below will create a new SWAP file that is 512 MB in size on a file /u01/swap/swapfile.

1. Run the following commands as 'root' to create the 512 MB swap file:
dd if=/dev/zero of=/u01/swap/swapfile bs=1024 count=524288
mkswap /u01/swap/swapfile

2. Edit /etc/fstab and add the following line:
/u01/swap/swapfile swap swap defaults 0 0

3. Reboot the server:
reboot

There are multiple ways to increase swap space, and I have only documented one way. I would not recommend the approach above for production based systems. For other (preferred) approaches, check out the link below.


Applicable Versions:
  • Red Hat 5.5
  • Oracle Enterprise Linux 5.5

References:
  • http://www.brighthub.com/computing/linux/articles/42348.aspx


Ahmed Aboulnaga

3 comments:

Viagra Online said...

Excellent, thanks a lot, I wonder why but I guess that this should be improved :P thanks

Fred | empresa paginas web said...

exists any way to do this in a virtual machine? i try it in a xen virtual machine and always said me "permission denied" even as root

Ahmed Aboulnaga said...

To be honest, I don't know. But try checking these log files:

/var/log/messages
/var/log/audit/audit.log