Skip to content

Why Overlaybd for Virtual Machines - #439

Open
lihuiba wants to merge 2 commits into
containerd:mainfrom
lihuiba:main
Open

Why Overlaybd for Virtual Machines#439
lihuiba wants to merge 2 commits into
containerd:mainfrom
lihuiba:main

Conversation

@lihuiba

@lihuiba lihuiba commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

What this PR does / why we need it:
why overlaybd for VMs

preview: https://lihuiba.github.io/overlaybd/#/vmimg

Comment thread docs/vmimg.md Outdated
chain carries its own table — each covering the full virtual disk,
because any guest block may resolve to any snapshot — and its own
cache in the hypervisor. A 30-snapshot chain does not have an index
problem of 12.5 MB; it has an index problem of 30 × 12.5 MB, with

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 12.5 MiB figure assumes that L2 tables covering the entire 100 GiB address space are allocated. qcow2 allocates L2 tables lazily; an untouched snapshot layer may contain only its small L1 table, while reads for absent L2 regions fall through to the backing file. Therefore, 30 × 12.5 MiB is a worst-case scenario for widely populated layers, not the general metadata cost of a 30-layer chain

@lihuiba lihuiba Aug 16, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the "100 GB" is actual amount of data, not disk size.

Comment thread docs/vmimg.md Outdated
wide because they carry more than an offset: flag bits mark each
cluster as copied, zero, or compressed, and the offset field
addresses an exabyte-scale file. QEMU's default L2 cache is about
1 MB — some 8% of the table — so the operator chooses between

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The stated QEMU L2 cache default is outdated. Current QEMU defaults l2-cache-size to 32 MiB on Linux and 8 MiB on non-Linux platforms when cache-size is not specified. Therefore, the claim that the default cache covers only 8% of a 12.5 MiB table is not true for current QEMU; the default Linux cache is large enough to hold that fully populated table. Please either scope this statement to a specific older QEMU version with a citation, or update the numbers and the resulting cache-pressure argument.

Ref: https://www.qemu.org/docs/master/system/qemu-manpage.html

Comment thread docs/vmimg.md

## The Dilemma: Index Memory Overhead vs Copy-on-Write Overhead

Every fixed-granularity table sits on the same trade-off curve. Table

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’m not deeply familiar with VHDX internals, so I may be missing an implementation detail here. However, the VHDX specification appears to allow a differencing disk to use PAYLOAD_BLOCK_PARTIALLY_PRESENT, with a sector bitmap indicating whether each sector should be read from the child or its parent. This seems to mean that a small write does not necessarily require copying the rest of the payload block from the parent. Would it be more accurate to distinguish mandatory copy-up from allocation or space amplification here?

Ref: https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-vhdx/01da203b-b3d7-487d-928b-22a460bbe177

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, partial block helps.

Comment thread docs/vmimg.md Outdated
tooling (`Merge-VHD`, Edit Disk) to collapse differencing-disk
chains back down.

- **QEMU** provides `block-commit` and `block-stream` in

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don’t think block-stream and block-commit are qemu-img commands. They appear to be live block operations exposed through QMP, while qemu-img provides offline commands such as commit and rebase. Could this be changed to say that QEMU provides these operations through QMP and link to the live block operations documentation instead?

References:

@fuweid fuweid left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Please squash into one commit and signoff

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.

2 participants