How to Repair Corrupt VHD File Using Simple Hacks & DIYs

Data is prone to corruption and VHD files are not able to escape from this. The aftermath of corruption can make our valuable information lost and it creates a difficult situation for us. So, in this handout, I’ll try to elaborate that what a VHD file is, how corruption takes place and how to repair corrupt VHD file using some simple but effective ways.

What a VHD File Is And What It Offers?

Microsoft’s virtual machine supports two kinds of file formats: VHD and VHDX. These are the file formats of the virtual hard disk and they are used for backing up a system image. VHD is a prior version of VHDX which varies from the file size. Before Windows Server 2012 the storage capacity of VHD file was 2 TB but after VHDX arrived the file limit got up to 64 TB and it became popular to backup a system image.

You can use it to save a big amount of money by installing multiple OS on a single machine without buying multiple computers for that. They are doing more than our imagination.

Why do they get corrupt and Inaccessible?

There are various reasons responsible for VM image file corruption. It could be a faulty hard drive, malicious entities, antiviruses itself and a faulty network can also be responsible for that. I’ve tried to list some common reasons for VHD corruption:

  • Malicious Entities or Viruses:

A malicious entity or virus can ruin our data files. They can cause corruption and can also make the file inaccessible.

  • A Corrupt Hard Disk:

There could be a failure in hard disk also or a manufacturing issue can lead towards VHD corruption.

  • Anti-virus itself:

Sometimes antivirus programs and encryption methods also create interference in the VM operations, which lead towards corruption and trouble.

  • A faulty network:

If the transfer media is not right and some issues are associated with the network then it could lead to data loss.

You Might Like:

How to Troubleshoot Stop 0x00000003 Error in Windows

Fix Error 0x00000002 / Windows cannot connect to the printer in Windows 7, 10, 13?

How to repair corrupt VHD File?

If somehow your image file is inaccessible or corrupted due to any reason, there is a possibility to recover them. There are various methods to restore your lost files back. Let’s see them:

  • VHD recovery via Windows Powershell: 

    The first and foremost method of restoring the data is through the Windows Powershell method. For this, you need to type and run some relatable commands. With the help of Windows PowerShell method, you can mount the respective folder to the root. Accordingly, run CHKDSK on the VHD file for the completion of the process.

Step 1. This command will help you select the corrupt file in order to get mounted.


Step 2. This command will help you in getting Image management Service.

$VHDService = get-wmiobject -class “Msvm_ImageManagementService” -namespace “root\virtualization” -computername “.”

$Result = $VHDService.Mount($VHDName)

Step 3. Now the VHD is been mounted so for checking purpose simply type the above command.

  • Recovery through Microsoft VHD repair tool: 

With the help of this executable file provided by Microsoft, the user can easily recover the respective VHD files in a short duration of time.

Simply you need to follow some steps and then you are done with it.

Step 1. Download .exe file of VHD recovery.

Step 2. Run the file as admin.

Step 3. Now, go for the provided command.

exe /repair <BaseVhdFileName> <FirstSnapshotAVhdFileName> [/quiet]

  • Recovery by using virtual machines: 

Another method for the repairing the corrupt file is by creating a virtual machine in your system which will help you out to solve the problem by repairing the corrupted VHD file.

Follow the below-mentioned steps to do so:

Step 1. In the first step, you have to create a new virtual server and attach a new hard disk with the new server.

Step 2. Now open the “settings” option and choose the newly added hard disk, after that select the corrupted file which you want to repair.

Step 3. Select the “compact” option by clicking on the virtual disk wizard button and go for the option “convert it to a fixed size virtual hard disk”.

Step 4. Save your repaired VHD file with a new file name.

The above method will compact the corrupted image file and you can now mount it over the original server with ease.

By following these methods you can easily repair corrupt VHD File of the virtual hard drive. If there are some issues found during the recovery process using the manual ways, you should go for a third party tool. I’ll suggest you the VHD File Repair Tool. It’s a free repair software, which lets you recover all type of Virtual Machine file formats like VHD, VHDX, VMDK, and VDI. So, I hope it will solve all your issues related to VHD corruption and inaccessibility of Virtual Machines data.