An attached VHD is a virtual hard disk file that has been mounted in Windows so it shows up as a normal drive. A VHD or VHDX file is a single file that acts like a whole hard disk, with partitions and a file system inside it. When you attach it, Windows lets you open it, read and write files and format it like a physical disk, and when you detach it, the file goes back to being an ordinary file.
Key takeaways
- VHD and VHDX are Microsoft virtual hard disk file formats. VHDX is the newer one, with a 64 TB limit and better resilience.
- Attaching, also called mounting, makes the file appear as a drive in File Explorer and Disk Management.
- You can attach a VHD with Disk Management, DiskPart or PowerShell, and detach it when done.
- VHDs are used for virtual machines, backups, testing and, in some cases, booting Windows from a file.
- Common problems are a locked file, missing permissions, an uninitialized disk or a missing drive letter.
What is a VHD?
A VHD (Virtual Hard Disk) is a file format that stores the contents of a hard disk drive inside one file. The file can hold a boot sector, partitions, a file system and all the files in it. Microsoft introduced the VHD format, and later added VHDX with larger size limits and better protection against corruption. The two formats are widely used by Hyper-V and other Windows tools.
What does attached VHD mean?
Attached VHD means Windows has opened the virtual disk file and presents it as a disk. In Disk Management, an attached VHD appears with its own disk number and a different icon from physical disks. You can assign a drive letter, create volumes and copy files in and out. The diagram shows the flow.
VHD vs VHDX: what is the difference?
VHDX is the newer format with higher limits and more protection. The table compares them.
| Feature | VHD | VHDX |
|---|---|---|
| Maximum size | 2 TB | 64 TB |
| Introduced | Earlier Hyper-V and Virtual PC | Windows 8 and Windows Server 2012 |
| Protection against power failure corruption | Limited | Built-in logging for better resilience |
| Large sector support | 512-byte sectors | Supports 4 KB sectors |
| Compatibility | Older tools and some clouds | Modern Windows and Hyper-V |
What are the types of virtual hard disks?
A virtual disk can be fixed, dynamically expanding or differencing. They differ in how they use space:
- Fixed size. The full size is allocated on the host disk when you create it. It gives predictable performance. Some cloud platforms require fixed VHDs for uploads.
- Dynamically expanding. The file starts small and grows as you add data, up to the maximum size. It saves space but can fragment the host disk.
- Differencing. A child disk stores only changes from a parent disk. It is useful for test environments and quick rollbacks.
How do you attach a VHD in Windows?
You can attach a VHD with Disk Management, DiskPart or PowerShell. Choose one method:
Attach with Disk Management
- Press Win+X and open Disk Management, or run
diskmgmt.msc. - Open the Action menu and choose Attach VHD.
- Browse to the .vhd or .vhdx file. Tick Read-only if you do not want to change it.
- Select OK. The disk appears with a new disk number.
- If the disk shows as Not Initialized, right-click it, choose Initialize Disk, then pick MBR or GPT. Only do this for a new, empty disk.
- Assign a drive letter if none is shown.
Attach with DiskPart
Open an elevated Command Prompt and run:
diskpart
select vdisk file="C:VMsdata.vhdx"
attach vdisk
To detach, run detach vdisk with the same disk selected.
Attach with PowerShell
Open PowerShell as administrator. Use Mount-VHD -Path "C:VMsdata.vhdx" to attach and Dismount-VHD -Path "C:VMsdata.vhdx" to detach. The Mount-VHD cmdlet is part of the Hyper-V module, so it may not be available on every edition of Windows.
Attach by double-clicking
On modern Windows, double-clicking a .vhd or .vhdx file in File Explorer mounts it as a drive. Right-click the new drive and choose Eject to detach it.
How do you create a new VHD?
You can create a VHD from Disk Management or PowerShell. In Disk Management, choose Action, then Create VHD, set the location, size, format and type, and then initialize and format the disk. In PowerShell, New-VHD -Path "C:VMsdata.vhdx" -SizeBytes 50GB -Dynamic creates a dynamically expanding 50 GB VHDX, and you can mount, initialize and format it afterwards.
What is an attached VHD used for?
VHDs are used wherever a portable, self-contained disk is helpful. Common uses include:
- Virtual machines. Hyper-V virtual machines store their disks as VHD or VHDX files. See how virtual desktops use shared infrastructure in our guide to the advantages of VDI.
- Backups. Windows system image backups can be saved as VHDX files, and some backup tools can attach them to read files. See bare metal restore for how full system images are used.
- Testing and labs. Create a disk, test software on it and delete it.
- Boot from VHD. Some Windows editions can start from a VHD, which allows dual-boot testing without repartitioning.
- Moving data. A VHD file can be copied to another computer or storage system. For related storage ideas, see raw device mapping in VMware.
What problems can happen and how do you fix them?
Most problems come from permissions, a file in use or an uninitialized disk. Try these fixes:
- Access denied. Run Disk Management, DiskPart or PowerShell as administrator.
- File in use or cannot attach. The VHD may already be attached or used by a virtual machine. Detach it or shut down the VM first.
- Disk not initialized. A new disk needs initializing. Do not initialize a disk that should already contain data. Check the file and try again.
- No drive letter. Right-click the volume in Disk Management and choose Change Drive Letter and Paths.
- File not found or not supported. Check the path. Some locations, such as certain network shares or compressed or encrypted folders, may not work for attaching.
- Corrupted file system. Run
chkdskon the attached drive letter after you back up the VHD file. - Attached VHD disappears after reboot. Attached VHDs are not persistent by default. Re-attach after restart, or use a scheduled task for automatic attach.
What are best practices for using VHDs?
Treat a VHD like a real disk and protect it accordingly. Good habits include:
- Store VHDs on fast, reliable disks with enough free space, and plan for growth of dynamic disks.
- Back up the VHD files, not only the host system, and keep tested restores. See our BC/DR guide.
- Use VHDX for new disks unless you need compatibility with old tools.
- Encrypt sensitive VHDs, for example with BitLocker.
- Detach VHDs before you move or copy them.
- Plan moves between systems with our data center migration checklist.
Frequently asked questions
What does attach VHD mean?
Attach VHD means to mount a virtual hard disk file so Windows treats it as a disk or drive. Detach reverses it.
Is a VHD the same as an ISO?
No. An ISO is an image of an optical disc, usually read-only. A VHD is a virtual hard disk that you can read, write and format.
Can I attach a VHD on Windows 11?
Yes. Windows 10 and 11 can attach VHD and VHDX files through Disk Management, DiskPart or by double-clicking the file in File Explorer.
How do I detach a VHD?
Right-click the drive in File Explorer and choose Eject, or right-click the disk in Disk Management and choose Detach VHD, or use DiskPart or PowerShell.
What is the maximum size of a VHDX?
64 TB. The older VHD format supports up to 2 TB.
Conclusion
An attached VHD is a virtual hard disk file that Windows presents as a drive, which makes it handy for virtual machines, backups and testing. Use VHDX for new disks, attach with Disk Management, DiskPart or PowerShell, protect and back up the files and detach them before you move them.