Created
April 27, 2016 21:23
-
-
Save jeffgreenca/7c6ed7d85f178540150536cfa73c5641 to your computer and use it in GitHub Desktop.
Add a swap file Linux
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
#!/bin/sh | |
echo "Current Memory Configuration" | |
free -m | |
read -p "Continue or ctrl-c? " | |
echo "Disk Free Space" | |
df -h | |
read -p "Make 4GB swap file at /swapfile? Continue or ctrl-c..." | |
echo "Allocating space..." | |
fallocate -l 4G /swapfile | |
echo "Formatting as swap..." | |
mkswap /swapfile | |
echo "Enabling swap..." | |
swapon /swapfile | |
echo "Result" | |
swapon -s | |
echo "Done." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment