Created
April 4, 2014 11:00
-
-
Save rwrrll/9972308 to your computer and use it in GitHub Desktop.
Create swap on EBS Instance Storage
This file contains hidden or 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
# Check for existing swaps: | |
swapon -s | |
# None listed? Then go for it! | |
# Create ~8GB empty file | |
sudo dd if=/dev/zero of=/mnt/swapfile bs=1M count=8192 | |
# Lock it down | |
sudo chown root:root /mnt/swapfile | |
sudo chmod 600 /mnt/swapfile | |
# Turn it into a swapfile | |
sudo mkswap /mnt/swapfile | |
sudo swapon /mnt/swapfile | |
# Update system | |
sudo echo "/mnt/swapfile swap swap defaults 0 0" >> /etc/fstab | |
swapon -a | |
# Check it's all good | |
swapon -s |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment