romach
11/30/2017 - 9:42 PM

Create swap

# check swap
sudo swapon -s

# see free memory and swap
free -m

# allocate swap file
sudo fallocate -l 2G /swapfile

# set swap file permissions
sudo chmod 600 /swapfile

# sets up a Linux swap area on a device or in a file.
sudo mkswap /swapfile

# enable for swapping
sudo swapon /swapfile

# see swap
sudo swapon -s

# see free memory
free -m

# enlarge swap file
sudo swapoff /swapfile

# make swap persistent
# add to /etc/fstab
/swapfile      none            swap    sw                           0 0