Created
September 27, 2021 12:49
-
-
Save shoemoney/92950e68235048f9545b1bbe0bb171bd to your computer and use it in GitHub Desktop.
Create Swap Partition and Activate On Amazon Linux 2
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
#first create the file this will make a 4gb file. do 20 count for 2gb etc.. | |
sudo dd if=/dev/zero of=/swapfile bs=128M count=32 | |
chmod 600 /swapfile | |
#format the file properly with mkswap | |
sudo mkswap /swapfile | |
#tell your system to activate it | |
swapon /swapfile | |
#test swap file | |
swapon -s | |
#if no errors add to fstab so it auto mounts: | |
echo '/swapfile swap swap defaults 0 0' > /etc/fstab |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment