Repair Corrupt Vhd (macOS)
Then he ran:
Marcus opened Disk Management (diskmgmt.msc). He clicked Action > Attach VHD . The dialog hung for 45 seconds before spitting out: "Virtual Disk Manager: The virtual disk is corrupted or unreadable."
chkdsk Y: /f /r /x CHKDSK ran for 90 minutes. It reported fixing three orphaned files and two bad clusters in the MFT (Master File Table). But when he unmounted and tried to attach the VHD again in Hyper-V? Same corruption error. CHKDSK fixed the filesystem inside the VHD, but not the container itself. repair corrupt vhd
Marcus knew a trick: mount the VHD as a raw disk using a loopback driver. He used OSFMount from PassMark. He mounted the VHD as a read-only raw drive letter Y: .
Marcus re-ran the PowerShell mount command, this time writable: Then he ran: Marcus opened Disk Management (diskmgmt
He navigated to Z:\Program Files\Microsoft SQL Server\MSSQL15.MSSQLSERVER\MSSQL\DATA\ . The .mdf and .ldf files were there. He ran DBCC CHECKDB against a test restore—no allocation errors.
Mount-VHD -Path E:\VHDs\prod_db_backup_2024.vhd -NoDriveLetter Get-Disk | Where-Object OperationalStatus -eq "OK" A new disk appeared: Disk 4 (Offline) . He brought it online, assigned a drive letter Z: , and held his breath. It reported fixing three orphaned files and two
The Ghost in the Machine: A VHD Repair