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: Sep 14, 2024

VHDX Repair: Comprehensive Guide to Fix Corrupt or Unreadable VHDX Files

Sometimes, the files you think are corrupted are just “unreadable” due to hardware problems or misconfiguration. For such files, you shouldn’t run a CHKDSK scan to fix them because doing so might make them get lost forever. That said, there are also real corrupt files, which can occur due to a variety of reasons, including virus attacks on the hard drive where the files are saved.

Well, whether your files are misconfigured – thus, appearing as though they are corrupted – or the files are actually corrupted, this article explains everything you should do, including recommending the right software programs to use in recovering/restoring the files. But then, what are VHDX files and does it mean to fix a corrupted one?

What Are VHDX and VHD Files?

Virtual Hard Disk (VHD) and Virtual Hard Disk Extended (VHDX) are file formats representing virtual hard disks. They are used primarily in virtual environments to store the data of virtual machines (VMs).

VHD Files

VHD is the older of the two formats and was introduced by Connectix, which Microsoft later acquired. This format is compatible with many legacy systems and has the following characteristics:

  • Size Limit: The maximum size of a VHD file is 2 TB.
  • Compatibility: It is widely compatible with various versions of Microsoft Virtual PC, Microsoft Hyper-V, and other virtualization platforms.
  • Types: VHD files can be of fixed size (pre-allocated disk space) or dynamically expanding (grows as data is added).
  • Usage: Primarily used in older versions of Microsoft Hyper-V and Microsoft Virtual Server.

VHDX Files

VHDX is the newer and more advanced format, introduced with Windows Server 2012. It offers several improvements over the VHD format:

  • Size Limit: The maximum size of a VHDX file is 64 TB, making it suitable for modern large-scale storage needs.
  • Performance: VHDX files provide better performance due to their ability to align with large sector disks, reducing I/O overhead.
  • Resilience: VHDX includes features for greater data protection against power failures, including a log that tracks updates to the VHDX metadata structures.
  • Types: Similar to VHD, VHDX files can be fixed or dynamically expanding, with an additional type called differencing disks (used for snapshots).
  • Usage: Commonly used in modern virtualization environments, such as Windows Server Hyper-V.

Key Differences Between VHD and VHDX

  1. Size Limitation:

    • VHD: Maximum of 2 TB.
    • VHDX: Maximum of 64 TB.
  2. Performance:

    • VHDX offers better performance, especially on large sector disks.
  3. Resilience:

    • VHDX has built-in protection against corruption due to power failures.
  4. Metadata:

    • VHDX maintains a log of updates to improve data integrity.
  5. Compatibility:

    • VHD is more compatible with older systems.
    • VHDX is designed for use with newer systems and offers advanced features not available in VHD.

What Happens When a VHDX File Goes Bad?

VHDX files, like any other digital files, can become corrupted or damaged, leading to a range of issues. When a VHDX file goes bad, it can affect the virtual machines (VMs) that rely on them for storage. Understanding the symptoms, causes, and potential solutions for a bad VHDX file is crucial for maintaining a healthy virtual environment.

Symptoms of a Bad VHDX File

  • Inaccessible Virtual Machine: The VM may fail to start or become unresponsive.
  • Error Messages: Specific error messages indicating file corruption, such as "Failed to open attachment" or "The file or directory is corrupted and unreadable."
  • Slow Performance: The VM may experience degraded performance, taking longer to read or write data.
  • Data Inconsistency: Files within the VM may become corrupted or exhibit inconsistencies.
  • Unexpected Crashes: The VM might crash unexpectedly during operation.

Causes of VHDX File Corruption

  • Power Failures: Sudden power loss can interrupt write operations, leading to corruption.
  • Hardware Failures: Issues with the storage media, such as bad sectors on a hard drive.
  • Software Bugs: Bugs in the virtualization platform or the operating system.
  • Improper Shutdowns: Forcibly shutting down the host or the VM without proper procedures.
  • Virus or Malware: Infection by malicious software that corrupts files.
  • File System Errors: Errors in the underlying file system that stores the VHDX file.

Common VHDX Repair Error Codes

When dealing with VHDX files, encountering error codes is a common scenario, especially when the file becomes corrupted or damaged. These error codes help identify the specific issues that need to be addressed during the repair process. Here are some common VHDX repair error codes and their meanings:

1. 0x80070057 - "The parameter is incorrect"

  • Description: This error typically occurs when the VHDX file is accessed improperly or there is an issue with the parameters passed during the operation.
  • Solution: Verify that all parameters and settings used to access the VHDX file are correct. Check for any syntax errors or incorrect values.

2. 0x80070005 - "Access is denied"

  • Description: This error indicates that the user or process attempting to access the VHDX file lacks the necessary permissions.
  • Solution: Ensure that the user or process has appropriate read/write permissions to the VHDX file and its containing folder. Adjust security settings if necessary.

3. 0x80070570 - "The file or directory is corrupted and unreadable"

  • Description: This error suggests that the VHDX file is corrupted and the system is unable to read its contents.
  • Solution: Use VHDX repair tools or third-party data recovery software to attempt to recover and repair the corrupted file.

4. 0xC03A0005 - "The requested operation cannot be performed on a file with a user-mapped section open"

  • Description: This error occurs when there are active processes or operations locking the VHDX file, preventing further actions.
  • Solution: Close any applications or processes that might be using the VHDX file. Ensure no other operations are locking the file before attempting repair.

5. 0x80070020 - "The process cannot access the file because it is being used by another process"

  • Description: This error indicates that the VHDX file is currently in use by another process, preventing access for repair operations.
  • Solution: Identify and terminate any processes that are using the VHDX file. Alternatively, perform the repair operation after ensuring the file is not in use.

6. 0xC03A001A - "The chain of virtual hard disks is broken"

  • Description: This error occurs when there is a problem with the chain of differencing disks, causing a break in the link.
  • Solution: Verify the chain of differencing disks and ensure all parent and child disks are accessible and correctly linked. Repair any broken links in the chain.

7. 0x87D00231 - "Error while merging VHDX files"

  • Description: This error occurs when an attempt to merge VHDX files fails due to corruption or other issues.
  • Solution: Check the integrity of the VHDX files being merged. Use repair tools to fix any corruption before attempting to merge again.

8. 0xC03A001C - "Failed to set the sector size for the VHD file"

  • Description: This error indicates an issue with setting the sector size for the VHDX file during operations.
  • Solution: Ensure that the sector size specified is valid and supported. Verify the VHDX file format and compatibility with the current environment.

9. 0xC03A001D - "The requested operation could not be completed due to a virtual disk service error"

  • Description: This error signifies a problem with the Virtual Disk Service, preventing the requested operation on the VHDX file.
  • Solution: Restart the Virtual Disk Service and retry the operation. If the issue persists, check the service status and logs for further diagnosis.

10. 0x80004005 - "Unspecified error"

  • Description: A generic error code indicating an unspecified problem with the VHDX file.
  • Solution: Investigate the specific context and logs for more detailed information. Use diagnostic tools to identify the root cause and apply appropriate fixes.

How to Repair a Corrupted VHDX File

VHDX file corruption can cause significant issues, making it crucial to repair the file to restore access to your data. Below are several methods to repair a corrupted VHDX file:

Method 1. Run CHKDSK Command to Repair Bad Sectors on VHDX

  1. Mount the VHDX File:
    • Open Disk Management by pressing Win + X and selecting "Disk Management."
    • Click "Action" > "Attach VHD" and select the corrupted VHDX file.
  2. Run CHKDSK:
    • Open Command Prompt as an administrator.
    • Run the command: chkdsk : /f /r
    • Replace with the letter assigned to the mounted VHDX file.

This command checks and repairs bad sectors on the VHDX file.

Method 2. Repair Using Windows PowerShell

  1. Open PowerShell as an Administrator:
    • Press Win + X and select "Windows PowerShell (Admin)."
  2. Repair VHDX:
    • Run the following command: Repair-VHD -Path "C:\path\to\your\VHDXfile.vhdx"
    • Replace "C:\path\to\your\VHDXfile.vhdx" with the actual path to your VHDX file.

This PowerShell command attempts to repair the corrupted VHDX file.

Method 3. Create a New Virtual Hard Disk

  1. Open Hyper-V Manager:
    • Go to Hyper-V Manager.
  2. Create New VHDX:
    • Click "New" > "Hard Disk" and follow the wizard to create a new VHDX file.
  3. Copy Data:
    • Mount both the corrupted and new VHDX files.
    • Copy the data from the corrupted VHDX to the new VHDX file.

This method creates a new VHDX file and transfers the data to it.

Method 4. Opt for VHD Repair Tool

  1. Choose a Reliable VHD Repair Tool:
    • Download and install a trusted VHD repair tool.
  2. Repair the VHDX File:
    • Follow the tool's instructions to scan and repair the corrupted VHDX file.

Professional VHD repair tools can offer advanced repair capabilities for severe corruption.

Method 5. Check Disk Utility by Running

  1. Mount the VHDX File:
    • Open Disk Management and attach the VHDX file.
  2. Run Disk Utility:
    • Open Command Prompt and use the diskpart command:
      shell
      diskpart select vdisk file="C:\path\to\your\VHDXfile.vhdx" detail vdisk
    • Inspect the disk details and attempt to fix issues using Disk Management or third-party utilities.

Method 6. Format VHDX to NTFS File System

  1. Mount the VHDX File:
    • Attach the VHDX file in Disk Management.
  2. Format to NTFS:
    • Right-click on the mounted VHDX volume and select "Format."
    • Choose "NTFS" as the file system and complete the formatting process.

Note: Formatting will erase all data on the VHDX file. Ensure you have a backup before proceeding.

Method 7. Delete and Create a New VHD Partition

  1. Mount the VHDX File:
    • Open Disk Management and attach the VHDX file.
  2. Delete Existing Partition:
    • Right-click on the existing partition within the VHDX and select "Delete Volume."
  3. Create New Partition:
    • Right-click on the unallocated space and select "New Simple Volume" to create a new partition.
  4. Format the New Partition:
    • Format the new partition as NTFS and assign a drive letter.

When to Use VHDX Repair Tool?

The DiskInternals VMFS Recovery is a specialized software designed to handle and recover corrupted VHDX files. Here are some scenarios where using this tool is advantageous to repair VHDX:

  • Severe Corruption: When standard methods like CHKDSK or PowerShell fail to repair the VHDX file due to severe corruption.
  • Data Recovery Needs: When there is a need to recover specific data from a corrupted VHDX file without repairing the entire file.
  • Multiple Corruption Issues: When the VHDX file is experiencing multiple forms of corruption, including file system errors and bad sectors.
  • Failed Virtual Machine Start: When a virtual machine fails to start due to VHDX corruption and other troubleshooting methods have been exhausted.
  • Professional Recovery: When a comprehensive and reliable recovery is needed, especially for critical data in enterprise environments.
  • Complex Disk Structures: When dealing with complex disk structures and differencing disks where manual repair is impractical.

Benefits of DiskInternals VMFS Recovery

The DiskInternals VMFS Recovery tool offers several benefits, making it a robust solution for VHDX file recovery:

  1. Comprehensive Recovery:

    • Capable of recovering data from severely corrupted VHDX files.
    • VHDX repair tool supports recovery from formatted, deleted, or damaged partitions.
  2. User-Friendly Interface:

    • Intuitive interface that simplifies the recovery process, making it accessible even for non-technical users.
    • Step-by-step wizards guide users through the recovery process.
  3. Advanced Scanning Algorithms:

    • Utilizes advanced algorithms to thoroughly scan and recover data from corrupted VHDX files.
    • Supports both quick and deep scan options based on the level of corruption.
  4. Wide Compatibility:

    • Compatible with various file systems, including NTFS, FAT, exFAT, ReFS, and others.
    • Supports recovery from multiple virtual disk formats, not just VHDX.
  5. Preview Functionality:

    • Allows users to preview recoverable files before initiating the recovery process.
    • Ensures that the correct files are recovered, saving time and effort.
  6. Selective Recovery:

    • Enables selective recovery of specific files or folders from the corrupted VHDX file.
    • Avoids the need to recover unnecessary data, streamlining the process.
  7. Reliable and Secure:

    • Ensures the integrity and confidentiality of the recovered data.
    • Maintains the original folder structure and file names during recovery.
  8. Technical Support:

    • Provides access to professional technical support to assist with complex recovery scenarios.
    • Offers detailed documentation and user guides for troubleshooting.
  9. Cost-Effective:

    • Reduces downtime and data loss, which can be critical in enterprise environments.
    • Offers a cost-effective alternative to professional data recovery services.

Ready to get your data back?

To start recovering your data, documents, databases, images, videos, and other files, press the FREE DOWNLOAD button below to get the latest version of DiskInternals VMFS Recovery® VHDX repair tool and begin the step-by-step recovery process. You can preview all recovered files absolutely for FREE. To check the current prices, please press the Get Prices button. If you need any assistance, please feel free to contact Technical Support. The team is here to help you get your data back!

Conclusion

VHDX files are fragile and can get corrupted easily. You should always back them up, take snapshots of your VM (linked to the VHDX) and ensure that you shut down the VM properly after each use – this way, you won’t be thrown off balance if the primary VHDX file gets corrupted.

Related articles

FREE DOWNLOADVer 4.23, WinBUY NOWFrom $699

Please rate this article.