Last active
July 12, 2019 14:32
-
-
Save Tiryoh/e82368a45a08dc704505749ea0e968fb to your computer and use it in GitHub Desktop.
create 2GB swapfile on Linux
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
#!/usr/bin/env bash | |
set -eu | |
sudo dd if=/dev/zero of=/var/swapfile bs=1M count=2048 | |
sudo mkswap /var/swapfile | |
sudo chmod 600 /var/swapfile | |
sudo swapon /var/swapfile | |
sudo cat /proc/swaps | |
echo "/var/swapfile swap swap defaults 0 0" | sudo tee -a /etc/fstab |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage