How often do you use Virtual Machine? If you use it regularly, you must be familiar with VHD aka Virtual Hard Disk file. It’s a hard disk image file used by Virtual PC on Microsoft Windows. The primary function of VHD file is to act as an individual hard disk for storing data within a single file. Being a hard disk, not physical but virtual, a VHD file is prone to corruption. There are various reasons which may cause corruption in VHD file, and make it inaccessible or unreadable. You must repair VHD file in order to access it on Virtual Machine. Here in this blog post, we’ll discuss on Virtual machine, its importance, VHD corruption and its fix. Keep reading here….
Virtual Machine – Why they are important…
Virtual machine is a program that acts like a computer system and runs on a host operating system. It creates a guest operating system which you can run on host system. On a single host computer system, you can install one or multiple Virtual Machines. The only limitation you would face is the amount of storage you have available for them.
Using a Virtual Machine gives you various benefits, such as:
- Testing new versions of operating systems
- Testing software on new platforms
- Experimentation with other operating systems
- Running/using software applications designed for other operating systems
- Using software applications which require outdated operating systems
- Consolidating servers
VHD Corruption – Nightmare for Virtual Machine Users
Have you ever experienced any error or issue while using Virtual Machine?
Failed to open attachment ‘C:\ directory \MyVHD.vhd’. Error: “The file or directory is corrupted and unreadable.”
If the above error message you’re receiving each and every time, this means the VHD file is corrupt. Sometimes it’s not necessary to figure out the exact cause behind VHD corruption. But still you must know the most common reasons for corruption, so that you can avoid them in future. Here below I’m showing you the most common reasons:
Virus Infection: It’s one of the most common reasons behind any type of file corruption. Unfortunately, no computer file is immune to corruption. Virus is a just like a computer program that may infect the files and other programs/applications installed on the system.
Software Bugs: Bugs are found in software which cause errors and crashing issues in a frequent manner. Sometimes such bugs may cause corruption in the files created by the software application. Virtual machine has also few minor bugs which may cause crash, and this will result in corruption.
Storage Media Failure: Though VHD acts as an individual hard disk, but it’s saved on your host computer system. If any type of storage media failure occurs on the main hard disk drive or if it crashes down, it may cause inaccessibility in the stored files including VHD file.
Software Malfunction: Software malfunction, also means software failure, can cause severe issues for users. Generally software application collide with other installed applications, and cause inaccessibility in the files.
Abruptly System Shutdown: Whenever you shutdown a running computer system abruptly or forcefully, it may severe damage to both software as well as hardware devices. Also, if you close Virtual Machine improperly, this may cause corruption in its Virtual hard disk (VHD) file.
Human Errors: Finally comes the human error, mistake done by humans. It may include many things, such as: accidental deletion or removal of important system files, cleaning system registry, forcefully termination or running process or program, improper disk management, etc.
There might be many other reasons as well apart from these (discussed above). But reasons or causes never matter because what’s done is done. Now you can’t do anything here! If you’re having a valid backup for your Virtual hard disk, I must say you’re lucky enough. You can restore your VHD file from the backup, but make sure the backup is valid and updated. But if there’s no backup available, the only thing you can try is to repair VHD file by using few easy manual tricks. Also, you can try professional VHD Recovery tool to perform VHD data recovery. But first, you should try the manual tricks as they don’t require any paid solution.
Repair VHD File – Easy Manual Tricks
You should try the manual tricks one by one. If both fail or don’t work, then only you should use VHD Recovery software to recover data from corrupt VHD files.
Repair VHD File using Windows PowerShell
Before you can repair VHD file, first of all you must check its integrity. This is the very first step to repair VHD file. You need to run a script on Windows PowerShell to mount the VHD file in the ROOT folder. After that, you can run a CHKDSK on it. Run the commands shown below:
#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)
Now you can run a CHKDSK on this VHD file.
Repair VHD File by Compacting
If the above trick works for you, it would be good. But if it fails or doesn’t work, you can try another one. This time you need to create a new Virtual Machine. After that, you can add the corrupt Virtual disk and then compact it. Follow the steps to know how to do that:
Step 1: Create new Virtual Server, and add a new hard disk.
Step 2: Now click Settings, and select the hard disk you have created earlier. Then browse to the VHD file that will not load.
Step 3: Click the Virtual Disk Wizard, and select the Compact option. Make sure the Convert it to a fixed-size Virtual hard disk option is selected.
Note: If the original size of your VHD is 50 GB in actual but it contains only 10 GB of data, then the new VHD file will only be compacted to 10 GB.
Step 4: Now you can save this VHD file as a new one with a new name (optional).
Once the VHD file is successfully compacted, copy the VHD file back to the original server and try to mount it.
Professional VHD Recovery Solution
There’s one more way to repair VHD file and to perform VHD data recovery. If both the manual tricks fail or don’t work, then you must consider using a VHD Recovery software. SysInfoTools Software provides you such recovery tool that can repair VHD file and recover your maximum possible data from it. Before you can purchase the licensed version of this software, you must download demo version for free evaluation.