How to perform VHD repair
Here you will find out:
- information about VHD and its corruption
- methods how to repair VHD
- how DiskInternals can help you
Are you ready? Let's read!
What is VHD?
VHD is an abbreviation of the words Virtual Hard Drive.
It is necessary for virtual machines, and it can be easily compared to a regular hard drive of a regular computer. It contains all the configurations, all kinds of folders, applications, and more. There is also such a thing as a VHD file - it contains the entire contents of the hard disk of a virtual machine in case of a system failure, i.e., applied as a backup. All of these components are, of course, protected and have a high degree of security, but there are still misses when the VM files are damaged.
Why corruption of VHD happens?
The reasons for this incident are no different from the damage to ordinary files on the hard disk:
- power surges as a result of the improper shutdown of the system during VM operation will lead to the loss of some files, especially unsaved files.
- a virus attack does not spare even a VM, so a good antivirus is worth a lot.
- an incorrectly working hard drive will crash the virtual drive. And this along the chain may well lead to the partial loss of data.
- unidentified data networks can also cause outages and damage files that were being transported.
- an antivirus obstacle or its incompatibility with VMs can lead to blocking of some data.
Of course, this is only part of the reasons that anything can lead to the loss of VHD files, and it is difficult to insure against this in advance.
One way or another, correct measures are required to repair VHD.
What to do at first if VHD is corrupted
If your VHD is damaged, you need to restore its data. When you have files, you can perform VHD recovery.
Here, the interesting part begins:
VHD - the disk of the virtual machine; this means that it can be from different file systems, depending on the environment in which it was created.
Let's explain: there are two file systems on virtual machines.
One, which is stored in the VM (NTFS / VMFS),and the second guest, which is located inside the virtual disk (NTFS / EXT / ZFS / XFS ...).
If you need to recover files from NTFS - use NTFS Recovery or Partition Recovery.
If you need to recover VMDK data from VMFS - use VMFS Recovery.
Let's dwell on each of these products separately.
1. DiskInternals Partition Recovery application - restores files of any type and format and has no limitations on the recovered volume of this data. The NTFS file system is easily converted, even if it is damaged - in this way, the program automatically copes with even the most severe damage. Each section of the disk is deeply examined for inaccessible and deleted files. Based on the foregoing, the percentage of the search for the necessary information reaches more than 95 percent. The program has a wizard for less experienced customers, and professionals can recover data manually by adjusting the application’s features “for themselves.” A preview is required, but do not worry here, as it is free.
Any recovered file can be exported to removable or stationary media, but you need to purchase a license (on the site, you do not need to go anywhere).
2. There is also an NTFS Recovery application - it also restores any files directly to the file system.
This program is more convenient to use if you are the owner of the Windows OS. In terms of basic parameters and options, it differs little from DiskInternals Partition Recovery, except that it is more narrowly targeted, as a result of which the search result, in this case, can be even more incomparable.
3. The DiskInternals VMFS Recovery application already differs from the above applications, since it returns VMDK data from VMFS.
Here are its main advantages and achievements: it recovers information from damaged or serviceable disks in VMFS format, VMDK files in VMware vSphere, and ESXi /ESX Servers remotely online (shutdown is not required). Here, for convenience, there is also a wizard, preview, and other standard DiskInternals functions.
Choose the right solution for repairingVHD and get to work.
Method 1. Repair corrupted VHD with CHKDSK
It should be noted that chkdsk is not safe for recoverable data.
Launch PowerShell and, through a few commands, launch CHKDSK.
These very commands:
$VHDName = "V:\serverx.vhd"
$VHDService = get-wmiobject -class "Msvm_ImageManagementService"
$Result = $VHDService.Mount($VHDName)
Now run CHKDSK on this virtual hard disk and check the disk repair.
Method 2. How to repair corrupt VHD files with PowerShell
To do this, open PowerShell and type the following commands:
Dism /Online /Clean-Image /CheckHealth
Dism /Online /Cleanup-Image /ScanHealth
Dism /Online /Clean Image /RestoreHealth
After these commands, the file should to be restored.
Method 3. Fix corrupt VHD with virtual server creation
As soon as you create a new virtual server, configure a new hard drive on it, and attach the VHD file to it using the Wizard. After that, select the .vhd file and save it as you wish. Thus, you learned how to repair a corrupt VHD file using various methods - choose the best and complete the job you started.