Add Swap file to AWS VPS
Updated at: 07/02/2017


Le macchine AWS nascono senza file swap (non so bene perché). Per aggiungerne uno, eseguire i seguenti comandi:
sudo /bin/dd if=/dev/zero of=/var/swap.1 bs=1M count=1024
sudo /sbin/mkswap /var/swap.1
sudo chmod 600 /var/swap.1
sudo /sbin/swapon /var/swap.1
If you need more than 1024 then change that to something higher. To enable it by default after reboot, add this line to /etc/fstab:
/var/swap.1 swap swap defaults 0 0
Fonte: http://stackoverflow.com/a/17173973/2607186