Last active
August 29, 2015 14:13
-
-
Save noherczeg/0250cf95734342f4035e to your computer and use it in GitHub Desktop.
vps swap creation put simple
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
| # tested on ubuntu 14.04 | |
| # ------------------------------------------ | |
| # CREATE SWAP: | |
| # ------------------------------------------ | |
| $ swapon -s | |
| $ free -m | |
| $ sudo fallocate -l 4G /swapfile | |
| $ ls -lh /swapfile | |
| # ------------------------------------------ | |
| # ENABLE SWAP: | |
| # ------------------------------------------ | |
| $ chmod 600 /swapfile | |
| $ ls -lh /swapfile | |
| $ sudo mkswap /swapfile | |
| $ sudo swapon /swapfile | |
| $ sudo swapon -s | |
| $ free -m | |
| # ------------------------------------------ | |
| # PERMA SWAP: | |
| # ------------------------------------------ | |
| $ sudo nano /etc/fstab | |
| # add to last line: | |
| # /swapfile none swap sw 0 0 | |
| # ------------------------------------------ | |
| # TWEAKS: | |
| # ------------------------------------------ | |
| $ sudo sysctl vm.swappiness=10 | |
| $ sudo nano /etc/sysctl.conf | |
| # add to last line: | |
| # vm.swappiness=10 | |
| $ sudo sysctl vm.vfs_cache_pressure=50 | |
| $ sudo nano /etc/sysctl.conf | |
| # add to last line: | |
| # vm.vfs_cache_pressure = 50 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment