Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion pkg/vm/applevirt.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down