Created
March 24, 2020 07:15
-
-
Save phongvh/abef85ab61578a949fdbe6382d5a6767 to your computer and use it in GitHub Desktop.
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/sh | |
echo "Create a 4 gigabyte swapfile" | |
sudo fallocate -l 4G /swapfile | |
echo "Secure the swapfile by restricting access to root" | |
sudo chmod 600 /swapfile | |
echo "Mark the file as a swap space" | |
sudo mkswap /swapfile | |
echo "Enable the swap" | |
sudo swapon /swapfile | |
echo "Persist swapfile over reboots" | |
echo "/swapfile none swap sw 0 0" | sudo tee -a /etc/fstab |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment