Last active
November 11, 2020 09:02
-
-
Save christianascone/470da640c89034d2fa403fdb4dd210f8 to your computer and use it in GitHub Desktop.
Create and enable/disable a swap file
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
#!/bin/bash | |
# Create 1GB swap file (change count if needed) | |
sudo dd if=/dev/zero of=/swapfile bs=1G count=1 | |
# Fix permissions | |
sudo chmod 600 /swapfile | |
# Make swap with given file | |
sudo mkswap /swapfile | |
# Enable swap | |
sudo swapon /swapfile | |
# Check Swap | |
sudo swapon -s |
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
#!/bin/bash | |
sudo swapoff -a |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment