Last active
July 20, 2022 11:03
-
-
Save alex-shpak/1deada2654dcd642aac2 to your computer and use it in GitHub Desktop.
swapon.sh /swap 2G
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 | |
FILE=${1-"/swapfile"} | |
SIZE=${2-"4G"} | |
fallocate -l $SIZE $FILE | |
chmod 600 $FILE | |
ls -lh $FILE | |
mkswap $FILE | |
swapon $FILE | |
swapon -s | |
echo "$FILE none swap sw 0 0" >> /etc/fstab | |
# https://www.digitalocean.com/community/tutorials/how-to-add-swap-on-ubuntu-14-04 | |
# $wget https://gist.githubusercontent.com/alex-shpak/1deada2654dcd642aac2/raw/6f6b1b6ab29286e6286907e9818cc02b0110b7ef/swapon.sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment