Fixing a corrupt VHD file

Error message – Failed to open attachment ‘C:\ vhddir \MyVHD.vhd’. Error: ‘The file or directory is corrupted and unreadable.’”

There could be many possible causes why your VHD may become corrupted. More often administrators tend to restore the backup from the snapshot catalog. This is to ensure an uptime guarantee. However, if we have enough time or in the event of not having a snapshot backup our options are very limited. Below are a few fixes that can be tried to repair the corrupt VHD file.

The main causes of data corruption irrespective of whether a VHD is fixed or dynamic are

  • A faulty or a failing physical storage
  • Data corruption when files are transferred over faulty or failing networks

Tracing the chain of events that led to corruption

  • Failure by disconnecting storage while the virtual drive was being created or moved over the network
  • Switching the disk type from one to the other or expanding the disk may sometimes trigger the problem

Fixes to try

  • Mount the vhd file to the parent partition, and then run chkdsk to repair it.
  • Check for integrity using Hyper-V. Add the vhd file to the IDE controller and then hit the Inspect button
  • Merge any VHD and AVHD files. Check if it can be opened through windows 7, server 2008 or WinImage (for Virtual PC and Virtual Server VHDs)
  • Finally, we can try the free Microsoft vhdtool that includes a “repair” function which is designed to undo an expanded operation on a base VHD when differencing VHDs are present

To get more updates you can follow us on Facebook, Twitter, LinkedIn

Subscribe to get free blog content to your Inbox