Skip to content

Instantly share code, notes, and snippets.

@morshadunnur
Last active June 4, 2020 10:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save morshadunnur/5c917f7aa2b5d28a9a4b062bd7ea41f4 to your computer and use it in GitHub Desktop.
Save morshadunnur/5c917f7aa2b5d28a9a4b062bd7ea41f4 to your computer and use it in GitHub Desktop.
Swap disk ubuntu
sudo fallocate -l 1G /swapfile
ls -lh /swapfile
sudo chmod 600 /swapfile
ls -lh /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
sudo swapon --show
We can change this by adding the swap file to our /etc/fstab file.
Back up the /etc/fstab file in case anything goes wrong:
sudo cp /etc/fstab /etc/fstab.bak
You can add the swap file information to the end of your /etc/fstab file by typing:
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
cat /proc/sys/vm/swappiness
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment