Skip to content

Instantly share code, notes, and snippets.

@khoa-le
Created January 22, 2021 04:54
Show Gist options
  • Save khoa-le/e9587af6827ee66f9e046b9a83c74185 to your computer and use it in GitHub Desktop.
Save khoa-le/e9587af6827ee66f9e046b9a83c74185 to your computer and use it in GitHub Desktop.
Create 4G Swap For Linux
#Create 4G swap (128M*32)
sudo dd if=/dev/zero of=/swapfile bs=128M count=32
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
6. Enable the swap file at boot time by editing the /etc/fstab file.
Open the file in the editor:
$ sudo vi /etc/fstab
Add the following new line at the end of the file, save the file, and then exit:
/swapfile swap swap defaults 0 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment