Skip to content

feat(ext4): mark file-backed images sparse on Windows and pre-check free space - #15

Merged
lstocchi merged 1 commit into
redhat-developer:mainfrom
lstocchi:sparse
Nov 21, 2026
Merged

lstocchi merged 1 commit into
redhat-developer:mainfrom
lstocchi:sparse

Conversation

@lstocchi

@lstocchi lstocchi commented Nov 21, 2026 •

Copy link
Copy Markdown
Collaborator

On NTFS, extending a dense file with set_len and writing scattered inode tables across block groups forces Windows to physically zero-fill the entire image up to the highest written offset.

  • Mark newly created output files sparse on Windows via FSCTL_SET_SPARSE (falling back with a warning if the volume does not support sparse files), matching the default sparse behavior on Linux.
  • Check available volume space (accounting for blocks reclaimable from an existing output file via GetCompressedFileSizeW) before truncating, failing early with ErrorKind::StorageFull instead of risking an in-page mapping error later.
  • Add Windows regression tests for sparse file creation and pre-truncation disk space validation, and update README.md and docs/supported-features.md.

…ree space

On NTFS, extending a dense file with `set_len` and writing scattered
inode tables across block groups forces Windows to physically zero-fill
the entire image up to the highest written offset.

- Mark newly created output files sparse on Windows via `FSCTL_SET_SPARSE`
  (falling back with a warning if the volume does not support sparse files),
  matching the default sparse behavior on Linux.
- Check available volume space (accounting for blocks reclaimable from an
  existing output file via `GetCompressedFileSizeW`) before truncating,
  failing early with `ErrorKind::StorageFull` instead of risking an
  in-page mapping error later.
- Add Windows regression tests for sparse file creation and pre-truncation
  disk space validation, and update `README.md` and `docs/supported-features.md`.

Assisted-by: Claude Code: GLM 5.3
Signed-off-by: Luca Stocchi <lstocchi@redhat.com>
@lstocchi
lstocchi merged commit 2c360ad into redhat-developer:main Nov 21, 2026
4 checks passed
@lstocchi
lstocchi deleted the sparse branch November 21, 2026 09:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant