fix(btrfs): allocate the swapfile with fallocate instead of dd

On a btrfs root the swapfile was written with dd from /dev/zero, so a
swapfile the size of the RAM cost tens of GiB of writes and stalled
every other writer on the filesystem. A caller that bounds the run, such
as an async Ansible task, killed dd halfway, and the next run found the
wrong size and started over. btrfs accepts a preallocated NOCOW
swapfile and the swap directory already carries +C, so every filesystem
now allocates with fallocate.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
kevinveenbirkenbachandClaude Opus 5.5 committed 2026-10-23 10:36:04 +02:00
1 parent 43cdce5fba
commit 91e1eff8a6
4 files changed
+19 -34

No files matched your search

+1 -1
View File
@@ -21,7 +21,7 @@ case "${SWAPFORGE}" in
esac
echo "ok: resolved from the installed package, not the source tree"
for binary in findmnt swapoff chmod mkswap swapon fallocate chattr btrfs dd; do
for binary in findmnt swapoff fallocate chmod mkswap swapon chattr btrfs; do
command -v "${binary}" >/dev/null || fail "${binary} is missing from the image"
done
echo "ok: every declared binary is present"