Last active
January 2, 2016 16:29
-
-
Save johnyaucc/8330156 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| # check for swap space | |
| swapon -s | |
| # check filesystem | |
| df -h | |
| # create and enabled the swap file (e.g. 512MB) | |
| sudo dd if=/dev/zero of=/swapfile bs=1024 count=512k | |
| sudo mkswap /swapfile | |
| # activate the swap file | |
| sudo swapon /swapfile | |
| # add swap to filesystem | |
| vi /etc/fstab | |
| # by pasting the following | |
| /swapfile swap swap defaults 0 0 | |
| # set ownership and permission | |
| chown root:root /swapfile | |
| chmod 600 /swapfile | |
| # configure swappiness (0-100, 100 = swap often and too soon usually) | |
| sysctl vm.swappiness=10 | |
| cat /proc/sys/vm/swappiness | |
| # (optional) set swappiness on boot | |
| vi /etc/sysctl.conf | |
| # and set | |
| vm.swappiness=10 | |
| # note: It may be useful to set your swappiness to 0 to ensure that your VPS operates optimally. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment