Skip to content

fix: use cached disk mode for macOS guests to prevent APFS corruption#664

Open
MarvinDontPanic wants to merge 1 commit intoinsidegui:mainfrom
MarvinDontPanic:fix/macos-caching-mode
Open

fix: use cached disk mode for macOS guests to prevent APFS corruption#664
MarvinDontPanic wants to merge 1 commit intoinsidegui:mainfrom
MarvinDontPanic:fix/macos-caching-mode

Conversation

@MarvinDontPanic
Copy link
Copy Markdown

Summary

Apply .cached + .fsync disk caching mode to macOS guests, matching the fix already applied to Linux guests in PR #332.

Problem

macOS guest VMs experience APFS filesystem corruption under heavy I/O because VZDiskImageStorageDeviceAttachment uses the default cachingMode: .automatic (effectively uncached). After sustained I/O (compilation, large git operations, concurrent writes), the APFS space manager becomes corrupted:

warning: spaceman chunk 507 free count 1048012 > block count 32768
error: (oid 0x765b) cib: found zeroed-out block
error: failed to read spaceman cib 7 at address 0x765b
Space manager is invalid.

This causes every subsequent write() syscall to fail with EILSEQ (errno 92), making the VM completely unable to write files. fsck_apfs -y cannot repair the damage.

Fix

Changed the else branch in createVZDiskImageStorageDeviceAttachment to use cachingMode: .cached, synchronizationMode: .fsync for macOS guests, identical to the Linux guest fix.

Related

The else branch for macOS guests was using the default cachingMode (.automatic),
which causes APFS space manager corruption under heavy I/O. Apply the same
.cached + .fsync fix that PR insidegui#332 applied to Linux guests.

Fixes filesystem corruption where write() returns EILSEQ (errno 92) after
sustained I/O workloads in macOS guest VMs.
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