# Swapfile

# create a swapfile

Create the designated file:

sudo fallocate -l 1G /swapfile

Restrict access:

sudo chmod 600 /swapfile

Define file as swap area:

sudo mkswap /swapfile

Activate the swap:

sudo swapon /swapfile

# deactivate swap and remove file:

sudo swapoff /swapfile && sudo rm /swapfile

# /etc/fstab entry

/swapfile    none    swap    sw    0   0