Have you ever used or created a VHD aka virtual hard disk file? If you’re unfamiliar with this term, I’ll help you understand what exactly a VHD file and what it is used for through this post. I’ll also talk about the corruption in VHD files, and the reasons why a VHD file gets corrupted. And finally the last but very important part will come in which you’ll learn how to repair VHD file. I want you to keep reading this post.
What is VHD File?
Let’s start this post with VHD file. To represent a virtual hard disk drive, Microsoft Virtual PC creates a file in VHD aka virtual hard disk format. Whatever the content is present on your physical hard disk drive, such as: boot record, disk partitions, file systems, files and folders, you can save the same content in a VHD file. Virtual machines primarily use VHD file as a logic disk.
In Windows Vista and later versions, VHD file is used as a backup for your system image. In Windows XP and earlier versions, NT-Backup tool is used to back up your system data. But it’s replaced by Backup and Restore tool in Windows Vista and later version. It supports two types of backup: file backup and system backup. If you want to back up a few specific files and folders, it’ll be saved into ZIP files as file backup. But if you want to back up your system, a disk image will be created and saved into VHD file format. I think this would be enough for you to know about VHD file. Now let’s talk about its creation.
How to Create VHD File?
The creation of VHD file is simply depends upon its use. If you want to create a VHD file for your virtual machine, you can use the disk management feature of Windows. Or if you want to take system backup, you can use Backup and Restore tool.
Let’s find out how to create VHD file with Window disk management feature:
Step 4: On Create and Attach Virtual Hard Disk window, browse a location for saving new VHD file and name it.
Also, define the file and virtual hard disk format, either Dynamically expanding or Fixed size. Click OK.
Finally you can check your VHD file.
Create VHD using Backup and Restore tool
The other way to create VHD file for system backup using Backup and Restore tool, follow the steps shown below:
Step 1: Go to Start, type Backup and Restore on search bar.
The backup job may take several minutes to hours, depending upon the size of your selected drive(s). Make sure no interference is occurred during the operation.
Windows users can also read tihs post Let’s Find Out How to Repair BKF File
As physical hard drives are prone to corruption, in the same VHD files can also be corrupted due to various reasons, such as: virus attacks, storage media failures, software malfunction, improper system shut down, any many more. At the time of corruption, you can’t access your VHD file anyhow. This situation may put your crucial data at high risk as you may lose them forever. Now the question is how to deal with this situation.
How to repair VHD file (virtual disk)?
Trick #1 to Repair VHD File
The best thing to start with is checking the integrity of a VHD file. This is the first step to repair VHD file. You can run a script on Windows PowerShell that will help you mount the VHD file in the root folder, and then you can run a CHKDSK on it. Run the commands given below (kindly change your detailed as per required):
#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)
You can now run a CHKDSK on this VHD.
Trick #2 to Repair VHD File
There’s one more way to repair VHD file. You can create a new Virtual Machine, add the corrupt Virtual disk file to it and then compact it. If you don’t know how to do this, follow the steps given below:
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.
Trick #3 to Repair VHD File
You can also use VHD Tool provided by Microsoft. It has an option to repair VHD file. Download the exe and run it as an administrator on your system with a command shown below:
VhdTool.exe /repair <BaseVhdFileName> <FirstSnapshotAVhdFileName> [/quiet]
Trick #4 to Repair VHD File
The last and the most efficient way to repair VHD file is professional VHD Recovery software. Such recovery software are highly capable to repair corrupt VHD file and to recover your maximum possible data from them. There are many vendors in the market providing you best and effective recovery software. SysInfoTools Software has recently introduced its new product range, Virtual Disk Recovery, in the market. The software products available in this range are easy and highly efficient to repair VHD file without requiring any prior technical expertise. Most of the time, novice users face problems while using professional software. But these tools contain easy and interactive user interface for both technical and non-technical users, so that even a novice user can use them with ease.
Why to choose Virtual Disk Recovery kit provided by SysInfoTools Software?
The Virtual Disk Recovery products range contains excellent recovery solutions which can repair corrupt Virtual disk files, such as: VHD (Virtual Hard Disk), VHDX (Hyper-V virtual hard disk) and VDI (Virtual Disk Image). Users are strongly recommended to download free demo version of these Virtual Disk Recovery software for free evaluation purpose.
You can also read this blog post to know how to recover files from VMDK.