Data Recovery

Repair VHD File to Restore Your Invaluable Data From It

We all know that the use of virtual hard drives has taken the digital data storage to the next level. And now we can confidently predict that the digital storage space and its high demand will grow even faster in the coming years. But still there’s a major drawback of using Virtual PC, and that’s corruption. The VHD files used by Virtual PC as a Virtual hard disk, are prone to corruption. We’ll discuss the most common reasons later in this post. Also, I’ll help you learn how to repair VHD file by using a couple of easy manual tricks.

Virtualization is so much popular

What do you think virtualization means? Is it good? Do you use it? If you do, how often do you use it? These are few questions what people generally ask to each other. As far as I’m concerned about virtualization, it’s very useful. How? Let’s talk about the advantages of using the Virtual Machine.

Advantages of Virtual Machine 

  • The best part of Virtual Machine is that you can run multiple operating systems simultaneously on the same system. However, all the operating systems are isolated from each other;
  • The Virtual Machine provides you instruction set architecture that’s completely different from the real computers;
  • It requires easy maintenance and provides application provisioning, availability, and convenient recovery; etc.

One thing that has many advantages, it must have few demerits also. The two most common problems you can face while using the Virtual Machine are:

  • Running multiple operating systems on the Virtual Machine at the same time will definitely give you poor performance. The performance completely depends on the workload on the system;
  • Also, while accessing the hardware, you find that the Virtual Machine is not that efficient as a real one; etc.

Though it’s not a physical hard disk, it works as a hard disk. And more than that, it’s a computer file. The fact says that there’s no computer file immune to corruption. There are numerous reasons which can cause corruption and lead to data loss. Let’s see what reasons are responsible for corruption in VHD files.

Corrupt VHD File. Why?

Have you ever confronted corruption in VHD files? Have you ever tried to find out the reasons responsible for corruption? Let me show you some common reasons which can cause corruption in VHD files:

Virus Infection: Virus is very harmful to your computer system and its files. Whenever it enters into your system, it causes a great damage by infecting the drives, folders, and particular files. Since VHD files are also stored on the system hard disk, they are subject to get infected by virus attacks.

Storage Media Failure: Storage media failure plays an important role in corruption. Any sort of failure in the storage media can cause you a great loss. If the storage media containing VHD files fails or crashes, it’ll increase the corruption possibilities.

Software Malfunction: The internal bugs in the applications can cause software malfunction. Sometimes two software applications may collide with each other.  All such inappropriate action can cause corruption and lead to data loss.

Improper System Shutdown: If a computer shuts down improperly or unexpectedly due to sudden power failure, things can really go bad. If you’re working on the VMWare (Virtual Machine) and suddenly the system shuts down due to any reason, the VHD file becomes prone to corruption. When you try to open the VHD file next time, you’ll find it accessible.

How to Repair VHD File?

If the VHD file is corrupt and you want to repair it, you can try a couple of easy manual tricks. The manual tricks I’m sharing here, don’t require any paid software. Also, Microsoft provides you the VHDTool.exe, a freeware VHD Repair tool. You can use it to repair VHD file. But if the corruption is severe, neither the manual tricks nor can the VHD tool help you. In such a situation, you should consider using a professional recovery solution. But before that, let’s see how we can repair VHD file manually.

Method #1 to Repair VHD File

Before you can try anything to repair VHD file, you should check its integrity. This is the very first thing you should do. First, run a script on Windows PowerShell to mount the VHD file in the ROOT folder. And after that, run a CHCDSK on it. Run the following commands:

#First we choose what VHD we want mounted
$VHDName = "V:\serverx.vhd"

#Get the MSVM_ImageManagementService

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

#Now we mount the VHD

$Result = $VHDService.Mount($VHDName)

Point to be noted: Don’t forget to change the details as per your requirement.

Now you can run CHKDSK on this corrupt VHD file.

Method #2 to Repair VHD File

You can also try this method to repair VHD file. You need to create a new Virtual Machine, and then you can add the corrupt VHD file into it. After that, compact the VHD file. How? Follow the steps given below:

Step 1: First, create a new Virtual Server. And then, add the new hard disk.

Step 2: Now click the Settings. And select the hard disk you’ve created earlier.

Step 3: Browse the corrupt VHD file, but don’t open it.

Step 4: Now click the Virtual Disk Wizard, and select the Compact option. Don’t forget to select Convert it to a fixed-size virtual hard disk option.

Point to be noted: If the size of your VHD file was 50 GB, it’s not necessary that the VHD file will be compacted to 50 GB. In fact, it’ll compact the drive as per the size of data available on the VHD file. For e.g. if you have 10 GB of files, then the VHD file will be compacted to 10 GB only.

Step 5: Save this new VHD file with a new name (optional).

Once you compact the VHD file successfully, copy it back to the original server and mount it.

Use VHDTool.exe to Repair VHD File 

If you fail to repair VHD file by using the above two manual tricks, you should try the VHDTool.exe provided by Microsoft. Download its executable file, and run it on your system. After that, run the following command to repair VHD file:

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

Point to be noted: Before running VHDTool.exe to repair VHD file, make sure you take backup of your original VHD file.

How to fix severe corruption?

If there’s severe corruption in VHD file or the corruption level is extremely high, neither the manual tricks nor can the VHD tool help you. In such a situation, you should consider using a professional recovery solution like VHD Recovery software. It’s one of the best data recovery software available in the market for Virtual disk recovery. Via this software, you can successfully restore almost every piece of information from corrupt VHD file. Whatever is left in the VHD file, the software will smartly recover that and save them into their original format at user-defined location. VHD Recovery software is available with the demo version for free evaluation. By using demo version, you can see a preview of your data which you can actually recover from the corrupt VHD file before purchasing the software. If you’re satisfied with the results, then only you should purchase its licensed version.

download now

Did you enjoy this blog? Don't forget to share it!