Thursday, November 24, 2011

add swap on AWS EC2 for CentOS

To add 512MB swap for example:

$ sudo dd if=/dev/zero of=/usr/swap0 bs=1M count=512
$ mkswap /usr/swap0
$ sudo swapon /usr/swap0

To use "top" command, you can see the swap is on.

To make it available on restart. Add following line to the end of your /etc/fstab file

/usr/swap0    swap    swap   defaults 0 0

No comments:

Post a Comment