Last active
August 29, 2015 14:24
-
-
Save jamesbee/8b42ba3f9971b76ba531 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
sudo -i | |
echo "Create '/swapfile'" | |
fallocate -l "$1G" /swapfile | |
chmod 600 /swapfile | |
mkswap /swapfile | |
swapon /swapfile | |
echo "" | |
echo "Swap status:" | |
swapon -s | |
echo "" | |
echo "" | |
echo "Mem status:" | |
free -m | |
echo "" | |
echo "Mount swap to fstab." | |
echo '/swapfile none swap sw 0 0' >> /etc/fstab | |
echo "Set swapniess to 10" | |
sysctl vm.swappiness=10 | |
echo vm.swappiness=10 >> /etc/sysctl.conf | |
echo "Set vfs cache pressure to 50" | |
sysctl vm.vfs_cache_pressure=50 | |
echo vm.vfs_cache_pressure = 50 >> /etc/sysctl.conf |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment