Issue:
If you are on a EC2 micro instance and constantly running out of memory or need additional swap space for your application requirements such as Oracle DB, Oracle UCM or SOA, you can follow the below Instructions to increase the swap space (default is zero)
Resolution:
- Login to your EC2 Instance and sudo to root
- Create a swap file on this device, run the following command for a 8GB swapfile
/bin/dd if=/dev/zero of=/var/mgdswap bs=1M count=8192
where /var/mgdswap = Name of the Swapfile
count = Size of the file - Make and flag it as Swap Space using the below command
/sbin/mkswap /var/mgdswap
- Set permissions on the file for group and user restrictions using the below command
chown root:root /var/mgdswap
chmod 600 /var/mgdswap
- Enable the swap using the below command
/sbin/swapon /var/mgdswap
- Now the most important step, to enable it by default after reboot, add the below line to /etc/fstab
/var/mgdswap swap swap defaults 0 0