Windows VHD and VHDX Explained Create Attach and Use Virtual Drives in Windows
A VHD is a whole hard disk packed inside a single file. Windows can plug that file in like a real drive, give it a letter, and let you use it for storage, testing, labs and backups - no extra hardware, no new partition. Here is the complete create, attach and use walkthrough.
✍️ Technical Anshu🪟 Windows 10 / 11⏱️ 9 minute read
🎥 Watch the video to see a VHD created, attached, used and detached live in Disk Management
Your PC has one physical disk, but a task needs a separate drive - a clean space for testing, a container for a backup, a disk you can carry to another machine. That is exactly the problem a Virtual Hard Disk (VHD) solves. A VHD is one ordinary file, ending in .vhd or .vhdx, that Windows treats as a real disk the moment you attach it. In the video this is shown end to end - create, attach, initialize, use, detach, and copy the file as a backup. This guide follows the same route and adds the honest details: what the size you type really means, and what detach does and does not do.
Disk Management - a VHD attached and working as a real disk (example)
Disk 0 - your real SSD, holds the C drivePhysical
Disk 1 - LabData.vhdx, attached, online, letter VVirtual
File on disk: D:\VHD\LabData.vhdx - one single filePortable
Detach Disk 1 and the drive letter vanishes - the file stays untouchedSafe
👆 Disk 1 is not hardware at all - it is one file on Disk 0, plugged in by Windows. Unplug it with Detach and your data stays inside the file.
1
What a VHD Actually Is
Think of a VHD as a hard disk that has been folded into a file. Inside that file there is a partition table, partitions and a file system - exactly like a physical disk. Windows has supported it for years, and the tools are already built in: Disk Management, DiskPart and PowerShell. Two formats exist:
VHD - the original format, maximum size 2,040 GB, understood by almost everything, including old software
VHDX - the newer format from Windows 8 and Server 2012 onwards, maximum size 64 TB, with protection against corruption during power cuts
The file can be fixed (takes its full size at once), dynamically expanding (grows as you fill it), or differencing (records only changes against a parent disk)
One honest warning before we start: the size you declare is a ceiling, not real space. A dynamically expanding 2 TB VHD on a 250 GB drive still holds at most 250 GB of real data - the video jokes about showing off a huge disk, but Windows cannot store bytes that have nowhere to live
2
Create Your First VHD in Disk Management
This is the route shown in the video. No downloads, no third-party tools:
Press Windows + R, type diskmgmt.msc and press Enter
Click Action → Create VHD
Browse to a folder with real free space and name the file, for example D:\VHD\LabData.vhdx
Set the size (start with 20-40 GB for experiments), choose format VHDX, and pick Dynamically expanding unless you have a reason for fixed
Click OK. The new disk appears at the bottom of Disk Management as Not Initialized
Right-click the disk name on the left → Initialize Disk → choose GPT for disks you will use with modern systems (MBR is fine for small test disks)
Right-click the unallocated space → New Simple Volume → assign a letter, format as NTFS, finish the wizard
Your new drive now shows in File Explorer, ready to use like any other disk
3
Attach and Detach - Plugging the File In and Out
Attaching is what makes the file become a drive. Detaching is the safe unplug. The difference matters, and it is a full topic in the video:
Attach: in Disk Management, Action → Attach VHD → browse to the file → OK. The drive appears with a letter. You can also right-click the file in Explorer and choose Mount
Detach: right-click the disk in Disk Management → Detach VHD. The drive letter disappears, Windows forgets the disk - and the file remains exactly as it was, with all your data inside
Read the detach dialog carefully: it has a checkbox that says Delete the virtual hard disk file after removing the disk. Leave it unticked. Ticking it deletes your data, not just the connection
Closing files before detaching is good discipline - an open document inside the VHD can lose its last changes, just like yanking out a USB drive
Restarting the PC also detaches everything. Attach again when you need the drive - nothing is lost
4
The Same Job from DiskPart
Everything above can be scripted. Open Command Prompt as administrator, run diskpart, then:
select vdisk file="D:\VHD\LabData.vhd" - points DiskPart at your file
attach vdisk - plugs it in, same as Attach VHD in the GUI
create partition primary then format fs=ntfs quick label=LabData then assign letter=V
detach vdisk - unplugs it safely when you are done
Note that DiskPart's create vdisk makes the .vhd format. For VHDX, use the Disk Management dialog or PowerShell New-VHD
5
What a VHD Is Honestly Good For
Testing and labs: a scratch disk you can fill, break and delete without touching your real partitions
A portable container: a whole disk of project files becomes one file you can copy to an external drive or another PC, then attach and use there - the backup and copy trick from the video
Virtual machine disks: every Hyper-V virtual machine keeps its hard disk as a VHD or VHDX file
Native boot: Windows itself can boot directly from a VHDX file, giving you a second Windows with no repartitioning - covered in its own guide on this site
Temporary storage: need a separate drive letter for a software test today, gone tomorrow? Attach, work, detach, delete
What it is not: faster storage. A VHD lives on your real disk, so it can never be quicker than that disk - it is convenience, not speed
🔴 Detach is not delete, and a VHD is not magic space. Detaching only unplugs the file - your data stays inside it. And a dynamically expanding VHD can promise 2 TB while sitting on a 250 GB drive, but the moment real data passes what the physical disk holds, writes start failing. Promise less than your real free space and the trick stays honest.
🎥 Watch the Complete Process in the Video
Create, attach, initialize, detach and copy a VHD - the full practical demo, step by step, in the video.
No. A VHD is only the hard disk - one file. A virtual machine is a whole virtual computer (CPU, RAM, motherboard) that uses a VHD as its disk. You can attach a VHD in normal Windows and use it as a plain drive without any virtual machine existing at all.
Can I really create a 2 TB VHD on a PC with only a 250 GB drive?
Yes, if it is dynamically expanding - Windows will create it happily because the file starts tiny and grows only as real data is written. But the ceiling is fiction: once the data inside approaches the 250 GB your physical disk actually has, the drive is full in every way that matters. The declared size is a maximum, never a gift of space.
Does detaching a VHD delete the files inside it?
No. Detach only disconnects the disk from Windows, like unplugging a USB drive. The .vhd or .vhdx file stays on your disk with everything inside it, ready to attach again. The only trap is the checkbox in the detach dialog that offers to delete the file after removing the disk - leave it unticked unless deleting is truly what you want.
This guide is based on the Technical Anshu Windows VHD video • Stuck on any step? Ask in the video comments — you will get a reply there 🙏