Created
June 12, 2020 15:29
-
-
Save lancewf/ef786778111435187c141bbbaaff07c9 to your computer and use it in GitHub Desktop.
Add a swap file to a vm
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
sudo fallocate -l 1G /swapfile | |
sudo dd if=/dev/zero of=/swapfile bs=1024 count=1048576 | |
sudo chmod 600 /swapfile | |
sudo mkswap /swapfile | |
sudo swapon /swapfile | |
echo "/swapfile swap swap defaults 0 0" >> /etc/fstab | |
mount -a | |
or | |
fallocate -l 1G /swapfile && dd if=/dev/zero of=/swapfile bs=1024 count=1048576 && chmod 600 /swapfile && mkswap /swapfile && swapon /swapfile && echo "/swapfile swap swap defaults 0 0" >> /etc/fstab && mount -a |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment