Add conversion to VHDX - #77
Open
AkihiroSuda wants to merge 1 commit into
Open
Conversation
Add vhdx.Writer, an io.WriterAt for a dynamic VHDX image that plugs into convert.Convert. Payload blocks are allocated on the first non-zero write, so zero and unallocated extents of the source become PAYLOAD_BLOCK_ZERO entries. Unwritten parts of the file are kept as holes by extending the file with Truncate when the target supports it. The default block size is 1 MiB for disks up to 1 TiB (doubling beyond that to keep the BAT at or under 8 MiB), smaller than the 8-32 MiB used by qemu-img, since file systems that do not support sparse files, or that fill small holes (APFS), allocate the unwritten part of every touched block. The example command gains `convert -O vhdx [-block-size N]`, and hack/compare-with-qemu-img.sh gains a phase converting to VHDX and comparing with qemu-img. Spec: https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-vhdx/83e061f8-f6e2-4de1-91bd-5d518a43d477 Assisted-by: Claude Fable 5.1 <noreply@anthropic.com> Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What This PR Changes
Add
vhdx.Writerfor converting raw/qcow2 to vhdx:Spec: https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-vhdx/83e061f8-f6e2-4de1-91bd-5d518a43d477
Linked Issue (Required in most cases)
For:
qemu-img.exe(used for converting qcow2/raw to vhdx) lima#5466How I Tested This
Used
hack/compare-with-qemu-img.sh.The script converts a qcow2 image to raw and vhdx, and compares them.
AI Usage
Assisted-by: Claude Fable 5.1 noreply@anthropic.com