What Is a VHD File?
VHD (Virtual Hard Disk) and its successor VHDX are file formats representing a virtual hard disk drive (HDD). They may contain what is found on a physical HDD, such as disk partitions, file systems, folders, and files.
They are typically used as the hard disk of a virtual machine created by Hyper-V. However, with the emergence of Windows 7 and Windows 2008 R2, the virtual hard disk in VHD format has been applied to the real system.
You can create a VHD in Disk Management directly. Here is the guide:
Step 1: Press “Win + R” to open the Run window. Input “diskmgmt.msc” in the box and press Enter to open Disk Management. Click the Action menu and select Create VHD.
Step 2: In the pop-up window, specify the location where to store the VHD or VHDX file (you need to type the file name manually), the VHD size, VHD format, and VHD type. Then click OK to execute the operation.
Then, you can use the VHD to deploy systems. The VHD has the following advantages:
- VHD disks operate just like physical disks and are easier to maintain. It can be partitioned, formatted, compressed, deleted, etc., and these operations do not affect the physical partition.
- It is as easy to load as a U disk. When you write some important data to the VHD partition and don’t want others to modify the content, you can take the VHD offline or separate it at any time, and then attach it to modify it when needed.
- VHD is just a file so it is easy to back up and transfer.
- VHD files are interoperable with VPC and Hyper-V virtual hard disks.
VHD File Is Corrupt and Unreadable
Like a real partition, VHD files may also become corrupt and unreadable. The error message may be “Failed to open attachment Error: The file or directory is corrupted or unreadable.” Why is the VHD file corrupt and unreadable? Here are some possible reasons:
- Physical Hard Disk Failure: The faulty or bad sectors in the hard disk where you have saved the VHD file may cause a corrupt VHD file.
- User Mismanagement: Some mistakes from users like unwanted deletion, bad disk management, etc. can corrupt the VHD file.
- Malware or Spyware Attack: There can be some malware attack on the VHD file that corrupts it severely.
How to Delete a Virtual Drive Windows 10 – 3 Ways
Recover Data from the Corrupt VHD File
When the VHD file is corrupt and unreadable, your data in the VHD may become inaccessible. If the data is very important to you, you can recover it using MiniTool Partition Wizard. It is a professional data and partition recovery tool. You can also use it to migrate OS, clone disk, etc.
MiniTool Partition Wizard DemoClick to Download100%Clean & Safe
Here is the guide on how to recover data from the VHD.
Step 1: Launch MiniTool Partition Wizard. In the main interface, click Data Recovery.
Step 2: Hover the cursor over the VHD partition and click Scan.
Step 3: After the scanning process is completed, find and select the files you want to recover and click Save. Please save them in a safe place.
You can find the files by expanding every folder under the Path tab or Type tab. You can also use the Find or Filter feature to find files.
Repair Corrupt VHD File
When the VHD file is corrupt and unreadable, you can try the following ways to fix the corrupt VHD file.
Way 1. Use Virtual Machine
As mentioned above, the VHD can also be accessed by a virtual machine. Therefore, you can try opening it in a virtual machine to see whether it can work normally. Here is the guide:
- Create a new virtual machine if you have no virtual machine on your PC.
- Connect the VHD to the virtual machine. You can do that by clicking on the virtual machine Settings option.
- Once done, click on the Virtual Disk Wizard and select Compact.
- Check the box next to Convert it to a fixed size virtual hard disk.
- Once you have performed all the above steps successfully, save the VHD file at the desired location on your system.
Way 2. Use Windows Powershell
- Open Windows PowerShell as an admin.
- Enter Mount-VHD-path d:\VHD\VHD.vhd –Readonly and press Enter.
- Enter Optimize-VHD-path d:\VHD\VHD.vhd –Modefull and press Enter.
- Enter Dismount-VHD-path d:\VHD\VHD.vhd and press Enter.
You need to replace the VHD file path accordingly.
Way 3. Use CHKDSK
- Press the “Win + R” keys to open the Run box.
- In the Run box, type “diskpart” and press Enter to open DiskPart.
- In the DiskPart window, type chkdsk D:/f/r/x and press Enter. This will automatically start repairing the VHD/VHDX files by repairing bad sectors on the file.
Way 4. Delete and Create a New VHD Partition
Open Disk Management. Right-click on the corrupt VHD partition and delete it. Then, right-click on the unallocated space to create a new partition. If possible, please set the file system as NTFS.
Bottom Line
Do you know other reasons for the corrupt VHD files? Do you know other ways to repair the corrupt VHD files? Share them with us in the following comment zone. In addition, if you encounter problems when using MiniTool Partition Wizard, please feel free to contact us via [email protected]. We will get back to you as soon as possible.