Have you ever used or created a VHD file aka Virtual hard disk? If you’re unfamiliar with this term, I’ll help you understand what exactly a VHD file is and why we should use it. Also, I’ll show you how to create VHD file in two different ways. After that, we’ll see why a VHD file gets corrupt. And finally, I’ll help you learn how to repair VHD file manually, i.e. without using any paid software.
What is VHD File?
Let’s start this post with an introduction of VHD file. To represent a Virtual hard disk drive, Microsoft Virtual PC will create VHD file in Virtual hard disk format. A physical hard disk contains boot record, disk partitions, file systems, as well as other files and folders. And a VHD file can also store all such content. A Virtual machine primarily uses 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?
Before you can create VHD file, you should know why you’re creating it. If you want to create VHD file for your Virtual machine, 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: On 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 in 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 failure, software malfunction, improper system shutdown, 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 to repair 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?
The Virtual Disk Recovery products range contains excellent recovery solutions which can repair corrupt Virtual hard 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 the 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