Skip to content

Instantly share code, notes, and snippets.

@avishaan
Last active January 6, 2017 06:55
Show Gist options
  • Save avishaan/ab1d03aba923fdb8b29dfc9ccc3a11a5 to your computer and use it in GitHub Desktop.
Save avishaan/ab1d03aba923fdb8b29dfc9ccc3a11a5 to your computer and use it in GitHub Desktop.
Create swapfile on
#!/bin/bash
#https://www.digitalocean.com/community/tutorials/how-to-add-swap-space-on-ubuntu-16-04
sudo fallocate -l 2G /swapfile
ls -lh /swapfile
chmod 0600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
sudo swapon --show
sudo cp /etc/fstab /etc/fstab.bak
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
sudo sysctl vm.swappiness=30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment