Troubleshooting Windows

Fixing a corrupt VHD file – Hyper-V


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 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.


Main causes of data corruption irrespective of a VHD being 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 sometime trigger the problem

Fixes to try

  • Mounting the vhd file to the parent partition, and then run chkdsk to repair it.
  • Check for integrity using the 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 expand operation on a base VHD when differencing VHDs are present


Related Articles

  • Citrix Xen VM Unresponsive, Will not shut down or start

      If you have ever worked with Citrix Xenserver for a long time, You have no doubt experienced having a VM turn unmanageable. Below are couple of scenarios and quick...
  • Adding IP’s to Windows Server 2012

    This article will help you add one or more IP’s to windows server 2012.   To start, look on the bottom right of the your display to find a icon...
  • How to List Compiled PHP Modules from the Command Line

    The general command is php -m; this command will give you the full list of extensions: php -m This command will give you an output like: bz2 calendar Core ctype...
  • Media tools installation Error/Fix

    While installing media tools like Neroacc, we might come across the following errors   ERROR: ====== /usr/ports/audio/linux-neroaaccodec]# make install clean ===>  Staging for linux-neroaaccodec-1.5.1 ===>   linux-neroaaccodec-1.5.1 depends on file: /compat/linux/etc/redhat-release...