{"id":628,"date":"2013-02-14T15:08:41","date_gmt":"2013-02-14T15:08:41","guid":{"rendered":"http:\/\/invisiblezero.net\/?p=385"},"modified":"2013-02-14T15:08:41","modified_gmt":"2013-02-14T15:08:41","slug":"amazon-ec2-common-problems-theres-no-swap-space","status":"publish","type":"post","link":"http:\/\/ndthanh.com\/amazon-ec2-common-problems-theres-no-swap-space\/","title":{"rendered":"Amazon EC2 common problems – there’s no swap space"},"content":{"rendered":"
Ubuntu EC2 EBS images don’t come with swap space configured (for 11.04 at least). The “regular” instance-type images do have a swap partition, though only 896 MB.<\/p>\n
<\/p>\n
If some process blows up and you don’t have enough memory or a swap space, your server could come to a crawling halt for a good while before the OOM (out of memory) killer kicks in, whereas with swap, it merely gets slow. For that reason, I always like to have swap space around, even with enough RAM.<\/p>\n
<\/p>\n
The simplest solution here is to create a swap file ( this is my favorite choice), we can create one (size 1024) using this command :<\/p>\n
\nsudo dd if=\/dev\/zero of=\/var\/swapfile bs=1M count=1024 &&\nsudo chmod 600 \/var\/swapfile &&\nsudo mkswap \/var\/swapfile &&\necho \/var\/swapfile none swap defaults 0 0 | sudo tee -a \/etc\/fstab &&\nsudo swapon -a\n<\/pre>\nDone. \ud83d\ude42 I know a lot of people feel icky about using files instead of partitions, but it certainly works well enough as emergency swap space.<\/p>\n
actually you can use a swap partition if you want to, but amazon EC2 “normal” instances don’t support it.<\/p>\n
collected from http:\/\/serverfault.com\/a\/279632<\/em><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"
Ubuntu EC2 EBS images don’t come with swap space configured (for 11.04 at least). The “regular” instance-type images do have a swap partition, though only 896 MB. If some process blows up and you don’t have enough memory or a swap space, your server could come to a crawling halt for a good while before…<\/p>\n