A Virtual Hard Disk (VHD or VHDX) is a standalone disk image file that functions identically to a physical hard drive. In Windows 11, the operating system can attach, initialise, and mount these virtual disk files directly, assigning them dedicated drive letters with standard filesystems such as NTFS, FAT32, or ReFS. Virtual disks provide isolated environments ideal for separating confidential client archives, testing operating system deployments, or maintaining portable backup containers secured with BitLocker drive encryption.
Understanding how to create and manage VHDX containers using Disk Management, PowerShell, and the Diskpart command-line utility gives you powerful storage management capabilities in Windows 11.
Comparing VHD vs VHDX Disk Formats
Before initializing a virtual drive, select the appropriate container format based on capacity and reliability requirements:
- VHD (Legacy): Supported across older Windows versions, but limited to a maximum storage capacity of 2 TB. It lacks native safeguards against structure corruption during unexpected shutdowns.
- VHDX (Modern Standard): The default virtual container format in modern Windows. Supports up to 64 TB of storage, features larger 4 KB logical sectors for enhanced storage efficiency, and logs metadata updates continuously to prevent file corruption during sudden system crashes or power outages.
- Fixed Size vs Dynamically Expanding: A Fixed virtual disk allocates the full specified size on your physical drive immediately upon creation. A Dynamically Expanding disk starts with a minimal footprint (under 10 MB) and grows automatically as you write data into it.
Method 1: Creating and Mounting a VHDX Using Disk Management
The graphical Disk Management console offers an intuitive interface to configure virtual drives:
- Right-click the Start button on the taskbar and select Disk Management (or press Win + R, type
diskmgmt.msc, and press Enter). - In the top application menu, click Action and select Create VHD.
- Click Browse to specify the directory path and filename where the container will reside (e.g.
D:StorageEncryptedVault.vhdx). - Set the Virtual hard disk size (for example,
50 GB). - Under “Virtual hard disk format”, select VHDX. Under “Virtual hard disk type”, select Dynamically expanding to conserve physical drive capacity. Click OK.
- Locate the newly created virtual disk in the lower drive list (it appears marked with a light blue disk icon and labeled “Not Initialized”).
- Right-click the disk header and select Initialize Disk. Select GPT (GUID Partition Table) and click OK.
- Right-click the adjacent unallocated space, select New Simple Volume, and step through the wizard to assign a drive letter (e.g.
V:) and format the volume with NTFS.
Method 2: Creating and Mounting a VHDX with PowerShell
For system automation, automated deployments, and administrative scripting, PowerShell provides the Storage and Hyper-V management cmdlets:
- Right-click the Start button and launch Terminal (Admin) or PowerShell as Administrator.
- Create a dynamically expanding 100 GB VHDX file:
New-VHD -Path "C:VirtualDisksDataStore.vhdx" -SizeBytes 100GB -Dynamic
- Mount the virtual disk file into Windows:
Mount-VHD -Path "C:VirtualDisksDataStore.vhdx"
- Initialize the disk, create a primary partition, and format it with an NTFS filesystem in a single pipeline command:
Initialize-Disk -VirtualDisk (Get-VHD -Path "C:VirtualDisksDataStore.vhdx") -PartitionStyle GPT -PassThru | New-Partition -AssignDriveLetter -UseMaximumSize | Format-Volume -FileSystem NTFS -NewFileSystemLabel "VirtualDrive" -Confirm:$false
Method 3: Quick Scripting via Diskpart
The legacy Diskpart command interpreter operates reliably in Windows Preinstallation Environments (WinPE) and emergency recovery command prompts:
- Launch an administrative Command Prompt and start the interpreter:
diskpart
- Execute the following commands sequentially:
create vdisk file="C:VirtualDisksRescueDisk.vhdx" maximum=20480 type=expandable
select vdisk file="C:VirtualDisksRescueDisk.vhdx"
attach vdisk
convert gpt
create partition primary
format fs=ntfs quick label="VirtualVault"
assign letter=X
exit
Safely Dismounting and Reattaching Virtual Disks
When you finish working with the files inside your virtual hard disk, safely detach the volume before moving or backing up the .vhdx file:
- Via File Explorer: Open This PC, right-click the virtual drive icon (e.g. drive
V:), and select Eject. Windows detaches the virtual drive cleanly. - Via PowerShell: Run the following command:
Dismount-VHD -Path "C:VirtualDisksDataStore.vhdx"
To mount the virtual disk again in the future, simply double-click the .vhdx file in File Explorer, and Windows 11 will automatically mount it back onto an available drive letter.