He downloaded VHDTool (a small open-source CLI utility). Its job: analyze and fix the VHD footer/header alignment.
The tool had detected that the dynamic VHD header had a checksum mismatch—likely from an unclean Hyper-V host shutdown. VHDTool recalculated the checksum and zeroed out the corrupted BAT entry that pointed to a non-existent sector. repair corrupt vhd
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. He downloaded VHDTool (a small open-source CLI utility)
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." VHDTool recalculated the checksum and zeroed out the
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.
vhdtool.exe /repair "E:\VHDs\prod_db_backup_2024.vhd" The output was promising: [INFO] Footer found at offset 4294967296. [INFO] Header checksum invalid. Recalculating... [INFO] Rebuilding BAT. 1 invalid block entry removed. [SUCCESS] VHD repaired.