Last active
March 14, 2019 15:39
-
-
Save Panthro/44bb6e67aad2a3eec4cc to your computer and use it in GitHub Desktop.
enable swap (4GB) and tweak it for a server
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
#Allocate the file | |
fallocate -l 4G /swapfile | |
#Give right permissions | |
chmod 600 /swapfile | |
#make it a swap file | |
mkswap /swapfile | |
#turn swap on | |
swapon /swapfile | |
#mount it at every boot | |
echo "/swapfile none swap sw 0 0" >> /etc/fstab | |
#tweak cache clean pressure | |
sysctl vm.vfs_cache_pressure=50 | |
echo "vm.vfs_cache_pressure=50" >> /etc/sysctl.conf | |
#change swappiness to 10% (When it's send to swap) | |
sysctl vm.swappiness=10 | |
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
To download it and execute in on line