How to create swap file for amazon EC2 EBS instance


Amazon instances do not create a swap partition by default. If you want an easy solution to create it, we can do the following:

sudo dd if=/dev/zero of=/var/swapfile bs=1M count=2048
sudo chmod 600 /var/swapfile
sudo mkswap /var/swapfile
echo /var/swapfile none swap defaults 0 0 | sudo tee -a /etc/fstab
sudo swapon -a

These instructions will create a 2Gb swap file. If you want to increase or reduce, just change the value of count=2048 in the first instruction

Comments

Popular posts from this blog

Installing Firebird ODBC driver on Ubuntu

Installing OCI8 on Ubuntu

Batch file to connect to an FTP and put a file