VMFS Recovery™
Recover data from damaged or formatted VMFS disks or VMDK files
Recover data from damaged or formatted VMFS disks or VMDK files
Last updated: May 14, 2024

How to Repair an Unreadable VHD File?

VHD (Virtual Hard Disk) is a file format developed by Windows OS as a proprietary disk image format for its virtual desktop platform. Although obsolete, the VHD format is still being used by some people, and as such, explaining how you can repair it is necessary. The VHD format is actually one of the most commonly used image file formats for virtualization environments.

What Is a VHD File?

Virtual Hard Drive (VHD) is Microsoft’s proprietary format for its virtualization platform. A VHD file may contain partitions and a file system just like physical HDDs. Also, a VHD file represents a virtual machine hosted in Microsoft’s Hyper-V environment. So, if a VHD file is deleted, the connected VM won’t open.

Just like every other virtual disk format, VHD files act exactly like physical hard drives (but the virtual version). If your VHD file is corrupt, you can actually repair it using specific tools (including third-party solutions).

How Does Become VHD Corrupted And Unreadable?

As mentioned earlier, VHD files are like the virtual version of physical drives. So, the content stored in them can also get corrupted due to several reasons. Apparently, when a VHD file is corrupt, you cannot access the data it stores. Here are some of the reasons why a VHD file may become corrupt.

  • Virus Attack: If a virus or malware finds its way into the VHD file or the directory where it is stored, the file will be corrupted.
  • Power Surges: Sudden power surges can cause logical volume damages, which could make your VMDK file inaccessible.
  • Improper Shutdowns: If you constantly do not shut down your Hyper-V VMs properly, over time, the VHD file may become corrupt.

System Crashes: System crashes such as HDD errors or OS crashes can corrupt some files in your primary hard drive. This is not always the case, but it’s one of the reasons why VHD files and some other file formats may get corrupted.

Repair VHD Files with VHD Data Recovery Tool

To repair and recover data from Virtual Hard Disk (VHD) files using DiskInternals VMFS Recovery, you'll need to follow a structured approach to maximize the chances of successfully retrieving important data from corrupted or damaged VHD files. DiskInternals VMFS Recovery, while primarily known for VMware environments, can also handle other types of virtual disks, such as VHD files used by Microsoft Virtual PC and Hyper-V.

Steps to Repair VHD Files Using DiskInternals VMFS Recovery

Step 1: Install DiskInternals VMFS Recovery

  1. 1. Download DiskInternals VMFS Recovery:

  2. 2. Install the Software:

    • Run the installer on a Windows machine.
    • Follow the installation prompts to complete the setup.

Step 2: Connect the Storage Media

  1. 1. Direct Connection:

    • If possible, directly connect the storage media containing the VHD file to your Windows system. This can be done via SATA, USB, or any other applicable connection method.
  2. 2. Network Connection:

    • If the VHD is hosted on a networked location or a Hyper-V server, ensure your machine has network access to this location.

Step 3: Launch DiskInternals VMFS Recovery

  1. 1. Start the Program:

    • Open DiskInternals VMFS Recovery from the desktop shortcut or start menu.
    • The software may ask for administrative privileges to access disks directly.
  2. 2. Scan for VHD Files:

    • Use the wizard to navigate to the location of the VHD file.
    • Start a scan for lost data or partitions on the VHD. The software automatically detects file systems and potential recoverable files.

Step 4: Recover Data from the VHD File

  1. 1. Preview Files:

    • Once the scan completes, browse through the recoverable files.
    • DiskInternals VMFS Recovery allows you to preview files before recovery, ensuring that the correct data is identified.
  2. 2. Select Files for Recovery:

    • Mark the files or folders you want to recover from the VHD.
    • If the entire VHD is to be recovered, you can opt to extract it in its entirety.
  3. 3. Save Recovered Files:

    • Choose a safe location to save the recovered files—preferably a different drive than the one on which the original VHD resides to avoid overwriting data.
    • Complete the recovery process by following the on-screen instructions to export the files.

Tips for Successful VHD Recovery

  • Avoid Writing to the Damaged Media: Do not write any new data to the VHD or the physical drive containing the VHD to prevent data overwriting.
  • Use a Reliable Host Machine: Ensure the machine used for recovery is stable and has enough resources to handle large data transfers without crashing.
  • Backup Regularly: Regular backups can prevent the need for recovery and protect data integrity.

Repair Corrupt VHD File Using Built-In Utilities

If third-party VHD recovery programs don’t work for you, there are some built-in utilities to use in repairing corrupt VHD files.

1. Use Another Virtual Machine

This method required setting up another Hyper-V VM using the VHD file, and seeing if you can access the data it contains. Sometimes, the reason you’re not able to read a VHD file is that the current VM it is mounted to is not properly configured. For this method, you need to:

  • Set up a new virtual machine and choose to install an external disk image file
  • Import the VHD file and mount it to the VM
  • Launch the Virtual Disk Wizard and select Compact.
  • Tick the checkbox beside Convert it to a fixed-size virtual hard disk.
  • Saved the VHD file to a specific directory on your primary storage

You can now try accessing the files in it – if the VHD file is still inaccessible, try the methods below.

2. Try Windows PowerShell Commands

This is an admin-level action, so you need to be logged into the system with an admin account.

  • Right-click on the Start icon and select PowerShell (admin), or press Windows Key + X
  • In the terminal interface, run the following commands:
    • Mount-VHD-path d:\VHD\VHD.vhd –Readonly
    • Optimize-VHD-path d:\VHD\VHD.vhd –Modefull
    • Dismount-VHD-path d:\VHD\VHD.vhd

(Note: Enter the actual path to your VHD file while tying the commands)

3. Using CHKDSK

Check Disk (CHKDSK) is equally an admin-level CLI utility that requires you to stay logged in to the system’s admin account to use.

  • Launch Command Prompt or PowerShell and run this command: Type: chkdsk D: /f /r /x

(Note: Replace the “D” with the actual drive letter of your hard disk that stores the VHD file).

4. Delete and Create a New VHD Partition

Well, if all the methods above are just not working for you, consider deleting the VHD partition to create a new one. However, this will clear any data you have on the old partition for you to start afresh. Hereunder is how to go about this:

  • Press Windows Key + R and type diskmgmt.msc – and hit Enter
  • Find the VHD partition and right-click on it
  • Select “Delete Volume” and confirm the deletion.
  • Now right-click on the “Unallocated Space” and select “New Simple Volume.”
  • Configure the new partition as your VHD partition and save it.

Close the Disk Management page.

Conclusion

Everything said here is valid, but there’s one more thing to note. If you run a virtualization environment or handle multiple VMs, it is advisable to set up regular automatic backups, as well as take snapshots from time to time. These will be your fallback solace in any critical situation having to do with the VM’s data files.

Similarly, you should keep a virtual hard drive recovery software handy; no one wishes to face a critical data loss situation, but these things find a way to happen – and you don’t want to be caught off guard. VHD is one of the trio disk image formats commonly used by IT admins in their virtualization environments; the other two are VMDK and VDI.

Related articles

FREE DOWNLOADVer 4.21, WinBUY NOWFrom $699

Please rate this article.