Virtual Hard Disk (VHD) files are generally created on a virtual machine server to work with different operating systems versions on a single system. It includes all contents like a physical hard disk, you can say it is the replica but in the virtual form and the content it contains are file systems, drives, disk partitions, boot records, etc. Its wide use is in backing up the image of system which stores the complete data in the hard disk. One can easily create a VHD file with the Windows Disk Management feature in the system.
Just like other files, VHD files as well are not resistant to the corruption issues or errors. These corruptions in VHD files results into errors which make the data unreadable or inaccessible and thus creating frustration to the user. The error message displays like this.
“Failed to open attachment ‘C:\ directory \xyz.vhd’. Error: ‘The VHD file or directory is corrupted and unreadable.”
Let us state some reasons which could cause the damage or corruptions in VHD files.
Some of the Primary Reasons for Damaged and Corrupt VHD Files are listed here
- Improper virtual system shutdown: The user should shut down the virtual system with great care as it cannot handle an improper shutdown and next time the virtual system will not open. If you are getting the error during startup, then it means that it was not properly shutdown last time.
- Failure of virtual hard disk: The faulty or bad sectors in hard disk where you have saved the VHD file can cause various types of errors. Then, you will need to delete the complete file and recreate a new one.
- “Paused state” of virtual machine: Paused state of virtual machine is a common error where the user tries to open a virtual system and it remains in the paused state. It can be due to an improper shutdown or corruption.
- Malware or spyware attack: There can be some malware attack on the VHD file that corrupts it severely. Many errors are directly related to the corrupt in VHD file and no manual method can repair it.
- User mismanagement: Some mistakes from users like unwanted deletion, bad disk management, etc. can corrupt the VHD file also.
Reasons could be one or more than one, but the end result is the corrupted Virtual Hard Disk file. And certainly, the next interest of the user facing this corruption error would be how to repair the corrupt VHD file. Without any delay and wasting any precious time of the users, let us focus on the solutions section. We have two free solutions to repair the corrupt VHD files. These methods are cost-free, feasible, requires some technicality and knowledge of running commands in Windows PowerShell. There is no fix guarantee for the success of these solutions and users can choose to perform these methods or solutions according to their interest and requirement.
Free Free Solutions to Repair Corrupt VHD Files
Important: Users are suggested to take an advanced backup of the current VHD files to secure its data to further gone loss or corrupted during the repair processes.
Solution #1 By Running Commands in Windows PowerShell
Launch the Windows PowerShell application in your system as an administrator and perform the procedure for repair with the given steps. It helps in mounting the corrupt VHD file in the root folder which otherwise is not possible.
- First step is to select that VHD file for mounting purpose. Run this command.
$VHDName = “V:\serverx.vhd”
- To get the MSVM_ImageManagementService, execute this command next.
$VHDService = get-wmiobject -class “Msvm_ImageManagementService” -namespace “root\virtualization” -computername “.”
- Mount the VHD file with this command.
$Result = $VHDService.Mount($VHDName)
- Now, run the CHKDSK command which will repair the virtual hard disk corrupted system files, bad sectors, etc. Open Command Prompt as an administrator and run this command.
chkdsk D: /f /r /x
There is another set of commands which can be run in the Windows PowerShell to scan, repair and restore the corrupted VHD files. Let us know this sequence of commands after user has launched the Windows PowerShell as an administrator.
- First command is to scan the image (VHD file) for any corruption.
Dism /Online /Clean-Image /CheckHealth
- Next, command is to check whether the file is corrupted or can be repaired further.
Dism /Online /Cleanup-Image /ScanHealth
- The combined command to repair and restore the corrupted files is as under.
Dism /Online /Clean-Image /RestoreHealth
It is a trial procedure which can be performed to fix the corruption but there is no guarantee of repair.
Solution #2 Through New Virtual Server
This method includes the repair process with the help of a newly created virtual server. Let us see how the process should be followed.
- Firstly, you need to create a new Virtual Server. After creating it, add a new hard disk to it as well.
- Go to the Settings option in Virtual Machine, click on the hard disk just created and then browse to add the corrupted VHD file.
- After adding the VHD file, open the Virtual Disk wizard and then choose Compact option. If the file original size is 100GB but the occupied space is 50GB only, then it will be compacted to 50GB size only.
Note: Select the option saying ‘Convert it to a fixed-size virtual hard disk’ to select the format as fixed-size. - Provide a new name to the VHD file and save it.
- Now, you can mount this compacted VHD file to its parent Virtual Server and see if the corruption issue is fixed.
Best Alternative –Third-party tool
If you do not feel satisfied with the above-mentioned free methods, we have the final and best solution for the VHD files recovery. VHD Recovery tool smoothly scans, repair and recover complete data with easy steps. Its latest version delivers more efficient and quick recovery with complete data integrity. Demo version is available free for a hands-on experience of the tool’s working. So, there would be no second thought for this tool after being analyzed by the user itself.
Sum Up
Virtual Hard Disks file corruption issues are inevitable and proper actions for its repair or recovery should be ensured. We have researched free recovery solutions too which are mentioned above and can be tried by the users. A safe backup for assured results, a third-party tool as the ultimate solution.
I faced many problems with my VHD files, but after read this methods my all issues were gone. By applying this methods my delete and corrupts VHD files got easily repaired. I was thankful to this blogger.
In the given blog, the free solution to repair corrupt or damaged VHD files is discussed and also the reasons for such corruption occurs in VHD files. The blog is really helpful for the users to fix corruption issues. Thanks to the author of this amazing technical article.
I used above manual solution to repair corrupted VHD files and I do it all alone. Every details related to VHD corruption or damaged are clearly mention in this blog. The blog author really made it with simple technical terms. Thanks for mentioning this method.
This blog explained really good method to repair corrupted VHD files. In this blog two methods are given and with following these methods I repaired my VHD files. With some technical expert help user can do this manual method.
I was facing VHD corruption issue before, one of my friends suggest me above blog to consider this free method. I applied this method and result amazed me. It completely repair my VHD file and now I am using this file.
I successfully attempt this manual method and repair VHD files. Thanks to the creator for sharing this useful method with easy tricks.