次の方法で共有


How to Fix a Corrupted Hyper-V VHD File

Symptoms and error messages for corrupted Hyper-V VHD files are numerous, from the VM refusing to start, to failures to attach the VHD with messages like

"Failed to open attachment 'C:\ directory \MyVHD.vhd'. Error: 'The file or directory is corrupted and unreadable.'”

There are many possible causes why your VHD may become corrupted. It is not necessary to figure out the exact cause if you need it back fast: just restore the VHD from your latest backup, or as Ben Armstrong puts it in his blogpost“Run data recovery tools inside the virtual machine."” As with all things in IT “fast” is a relative term – restoring a 500 GB disk from backup can take hours. Plan accordingly.

If you are going to take the time to investigate the cause, or do not have a backup, then you must “go all forensic”.

No mater what the VHD type, most common causes of data corruption in the VHD (whether fixed or dynamic)  are from:

  • Data corruption due to faulty / failing physical storage
  • Data corruption due to transferring files over faulty / failing networks

If you can trace back the chain of events leading to the corruption, you will usually find a failure either by disconnecting storage while the virtual drive was being created or moved over the network  Note that switching the disk-type from one to the other or expanding the disk may cause the problem, and, for some people, it has solved the problem. Sometimes this failure is not hardware, but caused by 3rd party encryption and anti-virus programs that have been installed on the host.

This Core Team blog post shows one way to begin your analysis.

Fixes to try:

Comments

  • Anonymous
    December 08, 2011
    Thanks for posting this fix. I encountered the exact same error when expanding the size of the .vhd file and I was concerned that I would have to rebuild the VM from scratch.  Does anyone know if this problem was address in Windows 2008 R2 edition? http://blogs.technet.com helped me always for hyper-v issue and another big source of hyperv i found very helpful http://www.hypervhd.com