Created
July 8, 2016 22:46
-
-
Save roramirez/5d6ce6933186d114a3815ef5c915b01a to your computer and use it in GitHub Desktop.
Create 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
fallocate -l 4G /swapfile | |
chmod 600 /swapfile | |
mkswap /swapfile | |
swapon /swapfile | |
echo "/swapfile none swap sw 0 0" >> /etc/fstab |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In Centos need use
sudo dd if=/dev/zero of=/swapfile count=4096 bs=1MiB
instead of
fallocate -l 4G /swapfile