Skip to content

Swap

Add Own Swap File

Create an empty file

sudo dd if=/dev/zero of=/media/swapfile.img bs=1024 count=1M

count=1M means an 1GiB file. If we want a larger swap, change this value.

Make it to a swap filesystem:

sudo mkswap /media/swapfile.img

Bring up on boot:

# Add this line to /etc/fstab
/media/swapfile.img swap swap sw 0 0

Activate:

sudo swapon /media/swapfile.img