Skip to content

Instantly share code, notes, and snippets.

@opunbuds
Forked from igez/add_swap.sh
Created November 1, 2016 05:55
Show Gist options
  • Save opunbuds/a01b1edd37f942af48aea40e84787634 to your computer and use it in GitHub Desktop.
Save opunbuds/a01b1edd37f942af48aea40e84787634 to your computer and use it in GitHub Desktop.
Add Swap Centos 7
#!/bin/bash
sudo fallocate -l 2G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
sudo echo "/swapfile swap swap sw 0 0" >> /etc/fstab
sudo sysctl vm.swappiness=10
sudo echo "vm.swappiness = 10" >> /etc/sysctl.conf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment