Skip to content

Swap file in Linux – how to create and configure it on a VPS

How to create a swap file on a Linux VPS with Ubuntu or Debian. Why you need swap, how big to make it, fallocate and mkswap, automatic activation through fstab, swappiness tuning, resizing and removal. Tested on Debian 12.