How to Repair VHDX File?

You can run Exchange Server on a virtual machine using Microsoft Hyper-V, a hardware virtualization tool to create and run virtual machines (VMs) on Windows. While creating a backup of the Exchange server on the platform, you can save the data in a Virtual Hard Disk (VHD) or Virtual Hard Disk Extended (VHDX) file. The VHDX file captures a complete snapshot of the Virtual Machine including the Exchange server. This file is easily portable, and you can move or copy it to any storage location or server.

In case of a server failure or a disaster, you can restore the Exchange server to the last known state using the VHDX file. However, if the file is corrupted, you are not able to access the data in the file. In such cases, you will have to repair the VHDX file and then restore the data.

What Causes Corruption in a VHDX Backup File

The VHDX file can get corrupted due to multiple reasons. To understand these reasons, we need to first explore the architecture of a VHDX file (see the following image):

architecture of a VHDX file

The VHDX file corruption can occur due to the following reasons:

  1. The backup application is not compatible with the three layers of the setup - the hypervisor, the operating system, and the Exchange Server.
  2. There could be corruption or damage on the backup destination or the restore destination, like a physical disk, a VHD, or a VHDX.
  3. The files may get corrupted when they are transferred over the faulty network. Also if the process to transfer of files in a virtual drive is interrupted, it can result in file corruption.
  4. Antivirus can also affect everything in the system by scanning and quarantining the files.

If the header or footer layer of a VHDX file is corrupt, you cannot repair it using any manual repair methods such as built-in Windows tools. You will need a specialized tool such as Stellar Mailbox Extractor for Exchange Backup to extract data from the corrupt VHDX file. However, if the operating system does not boot to restore a VHDX file, you can still restore the data stored in the VHDX file using the methods illustrated below.

Note: In this case, we will consider that the virtual machine is restored, but it does not boot.

Methods to Recover Exchange Backup VHDX File

You can try the following methods to fix the issue and restore the VHDX file.

Method 1- Run Check Disk Utility

Since the machine is not booting, it indicates that the system files or control files of the Windows operating system are corrupt. This could happen if the backup is corrupt or the backup application is not compatible.

In this case, firstly, turn off the machine. Now, mount the VHDX file on the host server and run a check disk scan on the operating system disk of the server. Here are the steps:

  1. Run the command prompt as Administrator.

command prompt as Administrator

  1. You need to identify the correct drive that contains the VHDX file. For this, you need to launch a disk management utility called diskpart. See below:

disk management utility

  1. Initiate the disk repair process using the following cmdlet:
chkdsk D: /f /r /x

disk repair process

This will initiate a scan for all system files of the operating system and mark the bad sectors, or corrupted system files.

Method 2- Use PowerShell cmdlets to Repair Corrupted VHDX Files

To repair the VHDX file using PowerShell cmdlets, you can follow the steps given below:

  1. Mount the VHDX file using the following cmdlet:
Mount-VHD -Path "d:\folder\vdisk.VHDX" –ReadOnly
Note: The ReadOnly parameter ensures that no changes are made in the VHDX file during the repair process.
  1. Optimize the VHDX file using the following cmdlet:
Optimize-VHD -Path "d:\folder\vdisk.VHDX" -Mode Full
  1. Dismount the VHDX file using the following cmdlet:
Dismount-VHD -Path "d:\folder\vdisk.vhdx"

Method 3- Re-install the Operating System Partition

Another method can be to re-install the operating system partition. Since all the configuration of the Exchange Server is stored in the Active Directory Schema, you can delete the affected partition and re-install the Windows operating system.

After this operation, you can re-install Exchange Server with the recovery option (see the below command) to retrieve the configurations from the Active Directory.

setup /mode:recoverserver /IAcceptExchangeServerLicenseTerms

re-install Exchange Server

Note: It is important that the same computer name and the same IP address are kept, else the installation will fail.

This will resolve the problem of the operating system not booting and that the Exchange Server is not active.

3. Perform Database Recovery using ESEUtil

If you are still unable to repair the VHDX file, you can use an EDB file to recover mailbox data. However, to access an EDB file, it should be in a mounted state. If the EDB file fails to mount on the server, it may be corrupt. In this case, you can perform EseUtil recovery process to repair the EDB file and recover data.

Perform EseUtil Soft Recovery process by using the command mentioned below.

Eseutil /r "path to the EDB file"

This command will replay the log files and commit the uncommitted changes on the database to make it consistent.

If this does not work, you can use the hard recovery. However, it will re-create the EDB file and purge anything that is deemed corrupted. There is no guarantee that the database will mount afterwards. In addition, Microsoft support team also does not support this form of recovery procedure. So, hard recovery must only be used as a last resort.

Database Recovery using ESEUtil

Use Stellar Toolkit for Exchange to Repair VHDX file

To avoid the hassle and complexity of the above solutions, you can use a specialized Exchange backup extractor tool called Stellar Mailbox Extractor for Exchange Backup. It is available as individual software or as part of the Stellar Toolkit for Exchange.

The application can open and repair corrupted Exchange database backup files, such as VHDX, BKF, and FD. It can also recover backups taken by HP, Symantec, or Veritas software. After repair, you can save the data in the PST or other formats, such as MSG, RTF, EML, HTML, and PDF. You can also directly export the data to a live Exchange Server with complete integrity.

Conclusion

To access and extract data from corrupt VHDX backup files of the Exchange server running on a virtual machine, you can use several proven methods. However, if you want an easier alternative to the complex processes, you can use a specialized Exchange backup extractor tool such as Stellar Mailbox Extractor for Exchange Backup, available with the Stellar Toolkit for Exchange. Additionally, if you are unable to extract your mailboxes from a VHDX file, you can use an EDB file. You can securely use the Stellar Repair for Exchange tool to repair severely corrupted EDB files and recover data without any hassle.



Was this article helpful?
About The Author
author image
Anubhuti Sinha linkdin Icon

Anubhuti is a tech enthusiast with deep expertise in Microsoft Exchange Server.

Table of Contents

WHY STELLAR® IS GLOBAL LEADER

Why Choose Stellar?
  • 0M+

    Customers

  • 0+

    Years of Excellence

  • 0+

    R&D Engineers

  • 0+

    Countries

  • 0+

    PARTNERS

  • 0+

    Awards Received