About the Project

About swappy

The story and engineering principles behind rapid, dependable Linux swap allocation.

Why was swappy created?

Every Linux systems administrator, DevOps engineer, or cloud architect has experienced the dreaded moment when a lightweight cloud virtual machine runs out of memory during a compiler build, Docker image generation, or sudden spike in web traffic.

When the Linux Out-Of-Memory (OOM) killer kicks in, critical processes are terminated indiscriminately. While adding more physical RAM is the ultimate long-term fix, provisioning an immediate swap file provides an essential safety net that prevents system crashes and gives services time to recover or complete memory-intensive tasks.

Traditionally, creating a swap file required executing 5–6 separate shell commands:

  1. Allocating contiguous blocks with dd or fallocate.
  2. Setting strict permissions with chmod 0600 to prevent local users from reading memory dumps.
  3. Setting root ownership with chown root:root.
  4. Formatting the file with swap signatures using mkswap.
  5. Enabling the swap area with swapon and specifying priority flags.
  6. Verifying active allocation with swapon -s.

swappy encapsulates these repetitive, error-prone steps into a single, reliable command: swappy init.

Open Source & Community

swappy is released under the GNU General Public License v3.0 (GPL-3.0). It is free to use, modify, distribute, and integrate into your own automation infrastructure, deployment pipelines, and configuration management playbooks.

Maintained by Joshua Cox and open source contributors worldwide on GitHub.