Last active
September 26, 2023 10:47
-
-
Save stilliard/00f0278cb98d513fe60d51f9d7c6f96d to your computer and use it in GitHub Desktop.
Setup swap partition
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
# 2gb example | |
# ref: https://www.digitalocean.com/community/tutorials/how-to-configure-virtual-memory-swap-file-on-a-vps | |
cd /var | |
touch swap.img | |
chmod 600 swap.img | |
dd if=/dev/zero of=/var/swap.img bs=2048k count=1000 | |
mkswap /var/swap.img | |
swapon /var/swap.img | |
echo "/var/swap.img none swap sw 0 0" >> /etc/fstab | |
sysctl -w vm.swappiness=10 | |
free # to check it's worked |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment