Skip to content

Instantly share code, notes, and snippets.

@sharshenov
Last active June 13, 2016 04:24
Show Gist options
  • Save sharshenov/a34db47c2311acd38c92 to your computer and use it in GitHub Desktop.
Save sharshenov/a34db47c2311acd38c92 to your computer and use it in GitHub Desktop.
add swapfile to ubuntu host
#Original article: https://www.digitalocean.com/community/tutorials/how-to-add-swap-on-ubuntu-12-04
dd if=/dev/zero of=/swapfile bs=1M count=1k
mkswap /swapfile
swapon /swapfile
echo '/swapfile none swap sw 0 0 ' >> /etc/fstab
echo 1 | tee /proc/sys/vm/swappiness
echo vm.swappiness = 1 | tee -a /etc/sysctl.conf
chown root:root /swapfile
chmod 0600 /swapfile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment