swapfile · shipping · also swap file, file-backed swap

Swapfile

A swapfile is a regular file configured as a backing area for operating-system paging.

Related Observatory article: Swapfile on hesela.com

Linux activation is a separate operation from creating or allocating the file. swapon rejects holes; whether fallocate-created extents are usable depends on the filesystem. Allocation success alone does not prove swap eligibility. [1]

Btrfs supports swapfiles since Linux 5.0, requiring preallocation without holes and NODATACOW, also excluding data checksums and compression. Its one-device placement and SINGLE data profile requirements concern the swapfile extents and their placement, not an unconditional ban on multi-device filesystems. [2] [3]

A subvolume containing an active Btrfs swapfile cannot be snapshotted. Hibernation also needs the correct device-specific resume offset; the Btrfs documentation warns against using filefrag output for it. [2]

Relations

related
File preallocation, Sparse file, Btrfs, zswap

Advantages

  • Provides a file-based paging area without requiring a dedicated swap partition.

Limitations

  • Apparent file length is not evidence of successful swap activation.
  • Filesystem, extent placement and active-use restrictions must be checked for the deployed configuration.

Citations

  1. util-linux: swapon(8), swapfile allocation restrictions (accessed 2026-11-14)
  2. Btrfs documentation: Swapfile, extent placement and active-file restrictions (accessed 2026-11-14)
  3. Linux v6.16: btrfs_swap_activate, profile and same-device checks (accessed 2026-11-14)
Sources & caveats
  • Linux swapon and Btrfs documentation reviewed 2026-11-14. This is a source-based eligibility explanation, not an activation recipe or tested hibernation setup.

JSON: /data/terms/swapfile.json

Published by Hesela team · Updated

Report a correction · Editorial standards · Reuse guidance

Cite this page
Hesela team. Swapfile. Hesela. 2026-11-14. https://hesela.dev/terms/swapfile/