From 6f506f9831512488aab775d720774bc4c55c6458 Mon Sep 17 00:00:00 2001 From: John McBride Date: Fri, 27 Feb 2026 21:56:57 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20fix:=20Apple=20raw=20disc=20resi?= =?UTF-8?q?ze=20now=20works=20with=20fsync?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: John McBride --- pkg/vm/applevirt.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pkg/vm/applevirt.go b/pkg/vm/applevirt.go index e8ee19d..34f507f 100644 --- a/pkg/vm/applevirt.go +++ b/pkg/vm/applevirt.go @@ -390,9 +390,17 @@ func (a *AppleVirtBackend) buildVMConfig( } // --- Disk (raw only) --- - diskAttachment, err := vz.NewDiskImageStorageDeviceAttachment( + // Use cached + fsync mode to ensure guest flush/sync operations are + // honored by the Virtualization.framework. Without explicit fsync mode, + // the framework may use DiskImageSynchronizationModeNone which silently + // drops guest sync calls. This causes ext4 metadata corruption during + // boot-time operations like growpart + resize2fs that rely on write + // ordering and fsync for journal/checksum consistency. + diskAttachment, err := vz.NewDiskImageStorageDeviceAttachmentWithCacheAndSync( inst.DiskPath(), false, // read-write + vz.DiskImageCachingModeCached, + vz.DiskImageSynchronizationModeFsync, ) if err != nil { return nil, fmt.Errorf("creating disk attachment for %s: %w", inst.DiskPath(), err)