Setting up a SWAP file on Digital Ocean
A SWAP file is a space on a hard disk used as the virtual memory extension of a computer’s real memory (RAM).
Having a swap file allows your computer’s operating system to pretend that you have more RAM than you actually do.
Digital Ocean Full Guides
Quick Setup Guide
- free
- cd /var
- touch swap.img
- chmod 600 swap.img
- dd if=/dev/zero of=/var/swap.img bs=1024k count=1000
- mkswap /var/swap.img
- swapon /var/swap.img
- echo “/var/swap.img none swap sw 0 0” » /etc/fstab
- reboot
Log in again and check status is changed with “free” command like in step 1.