github kernalix7/winpodx v0.4.3

latest releases: v0.12.1, REL-v0.12.1, v0.12.0...
6 months ago

[0.4.3] - 2026-05-06

The btrfs Copy-on-Write fragmentation fix. The 0.4.x line's headline storage rework: a per-user bind mount with automatic NoCoW so Windows VM disk image writes (every pagefile / boot / swap byte) stop forking new btrfs extents on every overwrite. On btrfs hosts that means pod recreates that previously took many minutes — and frequently timed out on the 300 s budget — finish in 30 s like they always did on ext4. Reported by @xiyeming in #121, #122 (and indirectly the actual-failure cause behind #126's "Unable to open apps and desktop" cascade on cachyos).

Highlights — five PRs landing the fix end-to-end. The migration design started at "chattr +C the entire podman graph root" (PR #124 — closed without merging because it would have flipped every container/volume/image on the host to NoCoW, which surprises btrfs snapshot users), pivoted to a per-user bind mount with chattr +C applied only to that one directory, and then took four follow-up patches as the smoke tests revealed each successive silent failure:

  1. PR #125 — bind mount + chattr +C + named-volume migration tool. Fresh installs default to ~/.local/share/winpodx/storage (chattr'd before compose-up so dockur's first raw-disk write inherits NoCoW). Existing users keep the named volume; winpodx setup --migrate-storage (or auto-trigger via winpodx migrate) moves it to the bind mount path without reinstalling Windows.
  2. PR #127 — compose-prefixed volume name resolution. podman-compose up materialises named volumes with the project name prefix (winpodx_winpodx-data, not winpodx-data); the migration's volume probe now tries the prefixed form first and falls back to bare.
  3. PR #128 — chattr +C outcome surfacing + post-rsync NoCoW verification. print() the apply / already-off / failed outcome so the user sees it during install.sh; re-lsattr both the dir and a sample .img after rsync to catch the silent-no-op case where chattr returned 0 but the flag never persisted.
  4. PR #129 — auto-migration refuses to re-run when the bind-mount target is already populated. Defends against the install.sh-runs-twice destructive scenario where a stale cfg.pod.storage_path would let _maybe_auto_migrate_storage rsync 64 GiB over the already-migrated NoCoW disk image with a fresh CoW copy.
  5. PR #130 — the actual root cause for "chattr never applies on fresh installs." plan_migration calls detect_path_fs(target) BEFORE the dir is mkdir'd. On openSUSE Tumbleweed findmnt --target <nonexistent_path> returns rc=1 with empty stdout (the docs lie) — detect_path_fs returned "unknown", chattr_will_run evaluated False, the entire chattr branch silently no-op'd, and PR #128's surfacing print never fired because the branch wasn't entered. Fix walks up to the nearest existing ancestor (max 64 steps; / always exists) before invoking findmnt.

Smoke-tested end-to-end on openSUSE Tumbleweed btrfs: clean wipe → v0.4.2 fresh install (creates winpodx_winpodx-data named volume) → upgrade to main → install.sh prints chattr +C applied to /home/.../winpodx/storage (NoCoW for new files) between Migrating storage... and OK: migrated 71 GiB; afterwards lsattr -d and lsattr data.img both show the C flag, dockur's Warning: COW (copy on write) is not disabled for disk image file /storage/data.img no longer appears in the journal, the named volume is removed, and the next podman-compose up mounts the bind mount and Windows boots without any CoW warning.

Added

  • Per-user storage bind mount with automatic btrfs NoCoW. winpodx setup on a fresh install now mounts the Windows VM disk image from a user-owned host directory (~/.local/share/winpodx/storage by default) instead of the legacy winpodx-data named volume. When the path lands on btrfs, setup runs chattr +C on the empty directory before compose-up — so dockur's first write of the Windows raw disk image inherits NoCoW from the parent and bypasses Copy-on-Write fragmentation entirely. The flag affects only this specific directory; other podman containers/volumes/images on the host are completely untouched (a deliberate design choice over a graph-root-wide flag, see PR #124's closed comment for the rationale). Existing users keep the named volume and see a one-line note pointing them at the migration command if their volume happens to be on btrfs. Reported by @xiyeming in #121, #122.
  • winpodx setup --migrate-storage. Move an existing winpodx-data named volume to the per-user bind mount path without reinstalling Windows. Pre-flight plan surfaces the source/target paths, source size, target filesystem, whether chattr will run, and free space on the target. Cost: ~5-10 min on NVMe (rsync -aS of ~60 GiB). The Windows install is preserved — no Sysprep redo, no ISO redownload. Idempotent: pod is stopped, btrfs chattr +C applied to the empty target so the copy lands NoCoW, contents rsync'd, cfg.pod.storage_path persisted, compose regenerated, old named volume removed only on success, pod restarted. On copy failure the source volume stays intact and the target is wiped so a retry has a clean slate. Override the destination with --migrate-storage-target PATH; skip the confirmation prompt with --yes.
  • Auto-migrate on upgrade. winpodx migrate (which install.sh calls on every upgrade) now detects the same condition — winpodx-data named volume, mountpoint on btrfs, cfg.pod.storage_path empty — and runs the migration automatically. Interactive runs prompt for confirmation (default Yes); non-interactive runs (install.sh post-upgrade path) just go ahead because the user is already in the degraded state and the whole point of running migrate is to apply fixes. On failure the original named volume is preserved and the user is pointed at winpodx setup --migrate-storage for manual retry.
  • cfg.pod.storage_path config field. Empty string preserves the legacy named-volume mode; an absolute path switches compose to a host bind mount at that path. Config.load validates the field and falls back to empty on bad values; _render_storage_blocks defends against unsafe values (newlines, quotes, brace characters) by reverting to the named volume so a hand-edited winpodx.toml can't corrupt compose YAML.

Fixed

  • Auto-migration was silently never running on compose-managed installs. storage_migration.named_volume_exists("podman", "winpodx-data") always returned False on installs created via podman-compose up because the actual volume on disk is winpodx_winpodx-data — podman-compose namespaces volumes by the compose project name (we declare name: "winpodx" in the template). Auto-migration in winpodx migrate and the Case-2 warning in winpodx setup both keyed off the bare name and therefore quietly classified every compose-managed btrfs install as "fresh-install" / "nothing to migrate". kernalix7 caught this on opensuse Tumbleweed (2026-05-06): the named volume was sitting at winpodx_winpodx-data, the auto-migrate hook had been dormant for hours. New resolve_named_volume(backend) probes the prefixed form first and falls back to the bare form, so both compose-managed and hand-created volumes resolve correctly. MigrationPlan.source_volume carries the resolved name through so the volume rm step at end of migration targets the same volume that was migrated.
  • detect_path_fs walks up to an existing ancestor before invoking findmnt. kernalix7's 2026-05-06 third smoke test (clean wipe → install v0.4.2 → upgrade to main) revealed the SILENT root cause of "chattr +C never applies": plan_migration calls detect_path_fs(~/.local/share/winpodx/storage) BEFORE the target directory is mkdir'd. On openSUSE Tumbleweed findmnt --target <nonexistent_path> returns rc=1 with empty stdout (despite docs claiming it falls back to the nearest existing parent), so the helper returned "unknown". That made chattr_will_run = (target_fs == "btrfs") evaluate to False, the entire chattr branch in execute_migration silently no-op'd, the post-rsync NoCoW verification (PR #128) had nothing to flag because chattr_will_run was False there too, AND PR #128's surfacing print() never fired because the branch wasn't entered. Three migrations in a row landed CoW-fragmented disk images while reporting "OK: migrated N GiB" with zero indication that NoCoW had been silently skipped. Fix walks up to 64 steps from the input path to the nearest existing ancestor (terminates at / which always exists) before passing the path to findmnt, so a not-yet-mkdir'd target still resolves to the fs that will contain it. chattr_will_run is now True for fresh-install migration plans on btrfs targets, which means the chattr +C apply, the inline print() of the outcome, and the post-rsync lsattr verification all actually run.
  • Auto-migration refuses to re-run when the bind-mount target is already populated. kernalix7's 2026-05-06 second smoke test on opensuse Tumbleweed exposed a confusing reproducer: install.sh ran a second time after PR #127 + #128 had merged, found cfg.pod.storage_path empty (root cause still under investigation — one possibility is install.sh's git-update step leaving a stale install dir whose PodConfig dataclass lacked the storage_path field, so Config.load silently dropped the value when round-tripping), AND found the named volume winpodx_winpodx-data recreated by podman-compose up with a 64 GiB raw disk. The auto-migration then ran a SECOND rsync -aS of 64 GiB into ~/.local/share/winpodx/storage — which was already populated with the FIRST migration's output (including the chattr +C-applied data.img from the manual recovery cp --reflink=never). The second rsync silently overwrote the NoCoW disk image with a fresh CoW-fragmented copy, undoing the entire perf benefit AND any data divergence between the named volume and the bind mount that had accumulated since the first migration. New defence: _maybe_auto_migrate_storage now checks default_target_path() (~/.local/share/winpodx/storage) BEFORE the named-volume probe; if that path exists and is non-empty, the hook bails out with a notice telling the user how to either restore storage_path in winpodx.toml or move the populated dir aside before retrying. The bind-mount data on disk is the source of truth — if a migration already happened, re-running cannot be safe.
  • chattr +C outcome is now visible inline AND verified post-migration. kernalix7's 2026-05-06 smoke test on opensuse Tumbleweed succeeded the auto-migration ("OK: migrated 64 GiB"), but lsattr -d afterwards showed no C flag on either the bind-mount directory or the freshly rsync'd 64 GiB data.img — the entire NoCoW benefit of the migration was silently missing because the chattr outcome only flowed through log.warning (filtered out of the install.sh foreground) and there was no post-rsync sanity check. execute_migration now (a) print()s every chattr outcome — disabled / already_off / failed — so the user sees inline whether NoCoW was applied, and (b) re-runs is_cow_disabled after rsync against both the target directory AND a sample *.img file from inside it; any discrepancy ("dir has +C but new file did not inherit", "chattr returned 0 but flag never persisted") is surfaced as a warning in MigrationResult.detail with a recovery recipe (cp --reflink=never of the affected file with the pod stopped). cp --reflink=never reads + rewrites the file inside the now-+C parent, so the new file is born NoCoW from inception and inherits the flag — the only safe way to retroactively fix a 64 GiB CoW disk image without reinstalling Windows.

Don't miss a new winpodx release

NewReleases is sending notifications on new releases.