Last active
August 29, 2015 14:22
-
-
Save yoimbert/b605c065968cfc2511de to your computer and use it in GitHub Desktop.
Swap On EC2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
You can add a 1 GB swap to your instance with these commands: | |
sudo dd if=/dev/zero of=/swapfile bs=1M count=1024 | |
sudo mkswap /swapfile | |
sudo swapon /swapfile | |
To enable it by default after reboot, add this line to /etc/fstab: | |
/swapfile swap swap defaults 0 0 | |
On DIGITALOCEAN | |
sudo dd if=/dev/zero of=/swap bs=1024 count=2097152 | |
sudo mkswap /swap && sudo chown root. /swap && sudo chmod 0600 /swap && sudo swapon /swap | |
sudo sh -c "echo /swap swap swap defaults 0 0 >> /etc/fstab" | |
sudo sh -c "echo vm.swappiness = 0 >> /etc/sysctl.conf && sysctl -p" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment