Skip to content

Instantly share code, notes, and snippets.

@dafonso
dafonso / create_swap_digital_ocean.sh
Created February 2, 2019 10:02
Add swap to a Digital Ocean droplet
rm -f /swapfile
# create swap file - adjust swapfile size to droplet memory
fallocate -l 1024M /swapfile
# make it swap
mkswap /swapfile
# chmod it accordingly
chmod 600 /swapfile
# enable swap
swapon /swapfile
# add it to fstab to be mounted on reboot