Skip to content

Instantly share code, notes, and snippets.

@adw0rd
Last active November 16, 2018 10:32
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 adw0rd/d20dfa01cb7a9ccf29ab4946b369a48c to your computer and use it in GitHub Desktop.
Save adw0rd/d20dfa01cb7a9ccf29ab4946b369a48c to your computer and use it in GitHub Desktop.
swapon -s
cp /etc/fstab /etc/fstab.bak
# For 4 CPU Core create 4 swap files:
for i in $(seq 0 3); do
fallocate -l 1G /swapfile$i;
mkswap /swapfile$i;
swapon /swapfile$i -p 10
echo "/swapfile$i none swap sw 0 0" >> /etc/fstab;
done
swapon -s
cp /etc/sysctl.conf /etc/sysctl.conf.bak
echo 'vm.swappiness=10' >> /etc/sysctl.conf
echo 'vm.vfs_cache_pressure=50' >> /etc/sysctl.conf
sysctl -p
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment