Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Commands to create swapfile on a Digital Ocean Ubuntu droplet
sudo fallocate -l 2G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
swapon -s
free -m

This comment has been minimized.

Copy link

@porimol porimol commented Jun 13, 2016

Hi @cobyism ,
How may I permanently add the swap file in my system?
Now I'm facing the problem is If I restart or shutdown the server the swap file remove or does not run! Then I have to have need re-create the swap file as your command.



This comment has been minimized.

Copy link

@orangewolf orangewolf commented Mar 30, 2017

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
You can’t perform that action at this time.