Windows: report free space of the volume backing the VM data directory - #121
Open
adihanifsdr wants to merge 1 commit into
Open
Windows: report free space of the volume backing the VM data directory#121adihanifsdr wants to merge 1 commit into
adihanifsdr wants to merge 1 commit into
Conversation
The New Sandbox dialog ("Free: N GB") and the headless /host endpoint
computed free space from the %ProgramData% root. VMs are actually stored
under %ProgramData%\AppSandbox, and users who redirect that directory to
another drive via a junction / mount point (a common fix when C: is small)
were shown the free space of C: rather than the drive their VHDX files
land on.
Query %ProgramData%\AppSandbox instead so GetDiskFreeSpaceEx resolves
the reparse point, and fall back to the %ProgramData% root when the
directory does not exist yet. This matches the macOS backend, which
already reports free space for the volume backing the VMs root.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Author
|
@jamesstringer90 heads-up on this one when you have a moment — small Windows-only fix so the "Free: N GB" figure in New Sandbox (and |
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.
Problem
On Windows, the New Sandbox dialog (
Free: N GB | VMs allocated: ...) and the headless/hostendpoint (freeGb) compute free space from the%ProgramData%root. VMs are actually stored under%ProgramData%\AppSandbox.Users with a small
C:commonly redirect that directory to another drive with a junction (mklink /J C:\ProgramData\AppSandbox D:\AppSandboxData). VHDX files then land onD:, but the UI keeps showing the free space ofC:, which is misleading when sizing a new sandbox.Before (VM storage junctioned to
D:, 155 GB free):C:\ProgramData(current code)C:\ProgramData\AppSandbox(this PR)D:\Change
src/app_win/ui.c(build_host_info_json) andsrc/app_win/headless.c(build_host_info): query%ProgramData%\AppSandboxsoGetDiskFreeSpaceExWresolves the reparse point, and fall back to the%ProgramData%root when the directory does not exist yet (fresh install).ui.c(C:\ProgramDatainstead ofC:\).This matches the macOS backend, whose
HostInfo.freeGbalready reports "free bytes on the volume that backs the VMs root directory".Testing
AppSandbox.slnRelease|x64 with MSBuild (VS 2026 Community); compiles clean apart from the pre-existingDwmSetWindowAttributewarning invm_display_idd.c.GetDiskFreeSpaceExWon a host whereC:\ProgramData\AppSandboxis a junction toD:(table above).🤖 Generated with Claude Code