Skip to content

Instantly share code, notes, and snippets.

@yashodhank
Forked from monobilisim/centos-swap.sh
Last active August 29, 2015 14:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yashodhank/cf8569f51df82a9bb207 to your computer and use it in GitHub Desktop.
Save yashodhank/cf8569f51df82a9bb207 to your computer and use it in GitHub Desktop.
#!/bin/sh
# count=4096k -> 4G
sudo dd if=/dev/zero of=/swapfile bs=1024 count=4096k
mkswap /swapfile
swapon /swapfile
chown root:root /swapfile
chmod 0600 /swapfile
sysctl vm.swappiness=10
cat /proc/sys/vm/swappiness
echo "/swapfile swap swap defaults 0 0" > /etc/fstab
echo "vm.swappiness = 0" > /etc/sysctl.conf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment