Skip to content

Instantly share code, notes, and snippets.

@ericfourrier
Last active September 14, 2016 12:32
Show Gist options
  • Save ericfourrier/3a7fe258db0978bd121038ef67571513 to your computer and use it in GitHub Desktop.
Save ericfourrier/3a7fe258db0978bd121038ef67571513 to your computer and use it in GitHub Desktop.
# Swap should take place on the Instance Storage (ephemeral) disk and not an EBS device.
# Check that your ephemeral storage is mounted sudo mount /dev/xvda2 /mnt
sudo dd if=/dev/zero of=/mnt/swapfile bs=1M count=16348 # create 16G swap
# Permission
sudo chown root:root /mnt/swapfile
sudo chmod 600 /mnt/swapfile
# Activate swapfile
sudo mkswap /mnt/swapfile
sudo swapon /mnt/swapfile
# add this to /etc/fstab
/mnt/swapfile swap swap defaults 0 0
# Activate swap
sudo swapon -a
# Config file to settle option
sudo nano /etc/sysctl.conf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment