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 drives, 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 logical 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 save them 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 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 1: On your desktop, right-click My Computer icon and click Manage.
Step 2: You can see the Computer Management window in the Windows Explorer.
Click Disk Management just below the Storage.
Step 3: At the right-hand side, you can see a separate area of Actions.
Click More Actions > option shown below Disk Management. Click Create VHD in the options.
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.
Step 5: Within a few seconds, the virtual hard disk (VHD) file will be created at the location defined earlier.
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 the search bar.
Step 2: You can see Control Panel > All Control Panel Items > Backup and Restore window on your system.
Step 3: On the Create a system image window, define where you want to save the backup file.
You may select either your system hard disk, on DVD or on a network. Click Next.
Step 4: Now select the drive(s) which you want to include in the backup.
Click Next to continue the process.
Step 5: Before you can start the backup job, please confirm your backup settings.
Finally, click the Start backup button.
The backup job may take several minutes to hours, depending on the size of your selected drive(s). Make sure no interference occurs during the operation.
Windows users can also read this post Let’s Find Out How to Repair BKF File
As physical hard drives are prone to corruption, in the same way, VHD files can also be corrupted due to various reasons, such as virus attacks, storage media failures, software malfunction, improper system shut down, and many others. 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. To repair VHD file, this would be the very first step. 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 details as per requirement):
#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 need to create a new Virtual Machine, then add the corrupt Virtual disk file to it. Now 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 you successfully compact the VHD file, 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 executable file, 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 tools are highly capable of repairing corrupt VHD file and to recover your maximum possible data from them. There are many software vendors in the market providing you best and effective recovery tools. 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 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). I strongly recommend users 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