How to Configure Storage for Hyper-V on Windows Server 2025
Storage configuration is one of the most consequential decisions in a Hyper-V deployment. The format of virtual disks, the type of provisioning, and the location of storage — whether local, SAN-backed, or SMB file share — directly impact VM performance, resilience, and manageability. Windows Server 2025 brings enhancements to VHDX resilience, Storage Spaces Direct integration, and SMB 3.1.1 capabilities that make it easier than ever to build a high-performing, flexible Hyper-V storage layer. This tutorial covers the full range of Hyper-V storage options: VHD versus VHDX, fixed versus dynamic versus differencing disks, expanding and compacting virtual disks, pass-through disks, SMB 3.0 file share storage, Cluster Shared Volumes, and Storage QoS.
Prerequisites
- Windows Server 2025 with the Hyper-V role installed
- PowerShell running as Administrator
- Adequate free disk space on the storage target for VHD/VHDX creation tests
- For SMB storage sections: a Windows Server 2025 file server with an SMB 3.0+ share configured
- For CSV sections: a Windows Server Failover Cluster with shared storage already provisioned
Step 1: Understanding VHD vs VHDX
Hyper-V supports two virtual disk formats: the legacy VHD format and the modern VHDX format. For all new deployments on Windows Server 2025, VHDX should be your default choice. The differences are significant and go beyond raw capacity.
- Maximum size: VHD is capped at 2 TB; VHDX supports up to 64 TB per disk.
- Resilience: VHDX uses a transaction log that protects the internal data structures from corruption during an unexpected power loss or host crash — a major advantage over VHD.
- Block alignment: VHDX uses 1 MB block alignment by default, which aligns well with modern storage sector sizes and reduces write amplification on SSDs and SAN LUNs.
- Sector size: VHDX supports 4 KB native sector (4Kn) emulation, required for some newer storage subsystems.
- Trim/Unmap: VHDX supports TRIM pass-through from guest OS to host storage, enabling thin-provisioned SAN arrays to reclaim freed blocks.
Convert existing VHD files to VHDX using Convert-VHD while the VM is off:
# Convert VHD to VHDX format
Convert-VHD -Path 'D:VHDsOldServer.vhd' `
-DestinationPath 'D:VHDsOldServer.vhdx' `
-VHDType Dynamic
# Verify the new file
Get-VHD -Path 'D:VHDsOldServer.vhdx'
Step 2: Creating Virtual Hard Disks with New-VHD
The New-VHD cmdlet supports three disk types: Fixed (pre-allocates all space immediately), Dynamic (grows on demand up to maximum size), and Differencing (stores only changes relative to a parent disk). Each has its own use case.
# Fixed-size VHDX — best for production workloads where predictable I/O performance matters
New-VHD -Path 'D:VHDsSQLServer01_Data.vhdx' `
-SizeBytes 500GB `
-Fixed
# Dynamic VHDX — conserves disk space; grows from a small initial footprint
New-VHD -Path 'D:VHDsDevVM01_OS.vhdx' `
-SizeBytes 127GB `
-Dynamic
# Differencing VHDX — stores only writes relative to a read-only parent (for linked clones)
# First create the read-only parent (golden image)
New-VHD -Path 'D:TemplatesWS2025_Core_Template.vhdx' `
-SizeBytes 60GB `
-Dynamic
# Mark parent as read-only to prevent accidental modification
Set-ItemProperty -Path 'D:TemplatesWS2025_Core_Template.vhdx' -Name IsReadOnly -Value $true
# Create a differencing child disk for a new VM
New-VHD -Path 'D:VHDsAppServer01_OS.vhdx' `
-ParentPath 'D:TemplatesWS2025_Core_Template.vhdx' `
-Differencing
# Inspect a VHD's metadata
Get-VHD -Path 'D:VHDsAppServer01_OS.vhdx' | Select-Object Path, VhdType, FileSize, Size, ParentPath
Step 3: Expanding and Compacting Virtual Disks
As storage requirements change, you can expand a VHDX without recreating the VM. After expanding the disk file, you must extend the volume inside the guest OS. Compacting reclaims whitespace in dynamic disks that have had data deleted — the disk file shrinks on the host even though the guest-level partition size remains unchanged.
# Expand an offline VHDX from its current size to 300 GB
# The VM must be shut down or the disk detached first
Resize-VHD -Path 'D:VHDsAppServer01_Data.vhdx' -SizeBytes 300GB
# After expanding the VHDX, connect to the VM and extend the partition inside the guest:
# (Run this inside the guest OS via Invoke-Command or direct console)
Invoke-Command -VMName 'AppServer01' -ScriptBlock {
# Find the disk and partition that needs extending
$disk = Get-Disk | Where-Object { $_.OperationalStatus -eq 'Online' } | Select-Object -Last 1
$partition = Get-Partition -DiskNumber $disk.Number | Where-Object { $_.Type -eq 'Basic' }
$maxSize = ($partition | Get-PartitionSupportedSize).SizeMax
Resize-Partition -DiskNumber $disk.Number -PartitionNumber $partition.PartitionNumber -Size $maxSize
}
# Compact a dynamic VHDX (reclaims space from deleted files inside the guest)
# The VM must be shut down
Optimize-VHD -Path 'D:VHDsDevVM01_OS.vhdx' -Mode Full
# Quick mode — faster but less thorough (does not zero-scan the disk first)
Optimize-VHD -Path 'D:VHDsDevVM01_OS.vhdx' -Mode Quick
# Check current file size vs. maximum size to gauge compaction benefit
Get-VHD -Path 'D:VHDsDevVM01_OS.vhdx' | Select-Object FileSize, Size |
ForEach-Object {
"File on disk: $([math]::Round($_.FileSize / 1GB, 2)) GB | Max size: $([math]::Round($_.Size / 1GB, 2)) GB"
}
Step 4: Using Pass-Through Disks
Pass-through disks give a VM direct access to a physical disk on the host, bypassing the virtualisation layer entirely. This eliminates the overhead of VHD translation and is sometimes used for I/O-intensive workloads like high-throughput SQL Server log drives. The physical disk must be taken offline on the host before it can be assigned as a pass-through disk to a VM.
# List physical disks on the host
Get-Disk | Select-Object Number, FriendlyName, Size, OperationalStatus, BusType
# Take the target disk offline on the host (required before pass-through assignment)
Set-Disk -Number 3 -IsOffline $true
# Attach the physical disk as a pass-through drive to a VM
Add-VMHardDiskDrive -VMName 'SQLServer01' `
-ControllerType SCSI `
-ControllerNumber 0 `
-ControllerLocation 2 `
-DiskNumber 3
# To remove the pass-through assignment and bring the disk back online on the host:
Remove-VMHardDiskDrive -VMName 'SQLServer01' `
-ControllerType SCSI `
-ControllerNumber 0 `
-ControllerLocation 2
Set-Disk -Number 3 -IsOffline $false
Note: Pass-through disks cannot be snapshotted, migrated with the VM during live migration (unless using storage migration separately), or backed up with VSS through Hyper-V. For most scenarios, a fixed-size VHDX on a fast NVMe volume provides comparable performance with far greater flexibility.
Step 5: Configuring SMB 3.0 File Share Storage for Hyper-V
SMB 3.0 (and the SMB 3.1.1 variant available in Windows Server 2025) allows Hyper-V to store VMs and VHDXs on a remote file server over the network, with the same resilience and performance guarantees as local storage — provided the file server and network are properly configured. This is a popular option for Scale-Out File Server (SOFS) deployments and Storage Spaces Direct.
# On the file server: create an SMB share suitable for Hyper-V
# The share requires Continuous Availability for Hyper-V live migration support
New-SmbShare -Name 'HyperVStorage' `
-Path 'E:HyperVStorage' `
-ContinuouslyAvailable $true `
-FullAccess 'DOMAINHyperVHosts$', 'DOMAINHyperVAdmins'
# On the Hyper-V host: set default VHD and VM paths to the SMB share
Set-VMHost -VirtualHardDiskPath '\FILESERVER01HyperVStorageVHDs'
Set-VMHost -VirtualMachinePath '\FILESERVER01HyperVStorageVMs'
# Verify the paths are set correctly
Get-VMHost | Select-Object VirtualHardDiskPath, VirtualMachinePath
# Create a new VM directly on the SMB share
New-VM -Name 'AppServer02' `
-MemoryStartupBytes 4GB `
-NewVHDPath '\FILESERVER01HyperVStorageVHDsAppServer02_OS.vhdx' `
-NewVHDSizeBytes 127GB `
-Generation 2 `
-SwitchName 'External-vSwitch'
# Verify SMB Multichannel and Continuous Availability on the connection
Get-SmbConnection | Where-Object { $_.ShareName -eq 'HyperVStorage' } |
Select-Object ServerName, ShareName, NumOpens, Dialect, ContinuouslyAvailable
Step 6: Working with Cluster Shared Volumes (CSV)
Cluster Shared Volumes allow multiple Hyper-V cluster nodes to simultaneously read and write to the same volume, making live migration and failover instantaneous without the need to transfer disk ownership between nodes. CSVs appear as a consistent namespace under C:ClusterStorage on every cluster node.
# On the cluster: view available disks that can be added as CSVs
Get-ClusterAvailableDisk
# Add a disk to the cluster and then convert it to a CSV
Get-ClusterAvailableDisk | Add-ClusterDisk
# Convert a clustered disk to a CSV
$clusterDisk = Get-ClusterResource | Where-Object { $_.ResourceType -eq 'Physical Disk' -and $_.Name -like 'Cluster Disk*' }
Add-ClusterSharedVolume -Name $clusterDisk.Name
# List all CSVs and their mount points
Get-ClusterSharedVolume | Select-Object Name, State, SharedVolumeInfo
# Create a new VM stored on a CSV (from any cluster node)
New-VM -Name 'ClusteredVM01' `
-MemoryStartupBytes 4GB `
-NewVHDPath 'C:ClusterStorageVolume1VMsClusteredVM01ClusteredVM01_OS.vhdx' `
-NewVHDSizeBytes 127GB `
-Generation 2
# Make the VM highly available (registers it as a cluster role)
Add-ClusterVirtualMachineRole -VMName 'ClusteredVM01'
# Check CSV health and usage
Get-ClusterSharedVolumeState
Step 7: Configuring Storage QoS
Storage Quality of Service (QoS) in Hyper-V lets you set minimum and maximum IOPS limits on a per-VM or per-VHDX basis. This prevents noisy-neighbour situations where one VM’s heavy disk I/O degrades the experience of other VMs on the same host or storage pool.
# Apply a storage QoS policy directly to a VM's hard disk drive
# Limit to a maximum of 3000 IOPS with a minimum guaranteed 500 IOPS
Set-VMHardDiskDrive -VMName 'WebServer01' `
-ControllerType SCSI `
-ControllerNumber 0 `
-ControllerLocation 0 `
-MaximumIOPS 3000 `
-MinimumIOPS 500
# Check the QoS settings on all hard disks for a VM
Get-VMHardDiskDrive -VMName 'WebServer01' | Select-Object Path, MaximumIOPS, MinimumIOPS
# For centralised policy-based QoS (requires Scale-Out File Server with Storage QoS):
# Create a QoS policy on the file server
New-StorageQosPolicy -Name 'WebTierPolicy' `
-PolicyType Aggregated `
-MaximumIops 5000 `
-MinimumIops 1000
# Apply the policy to a VHD (on the file server side)
Get-StorageQosPolicy -Name 'WebTierPolicy'
# Monitor real-time IOPS for all VHDs on a host
Get-VM | ForEach-Object {
Get-VMHardDiskDrive -VMName $_.Name | ForEach-Object {
Get-VHD -Path $_.Path | Select-Object Path, Attached
}
}
Conclusion
Effective Hyper-V storage configuration on Windows Server 2025 means selecting the right disk format (VHDX in almost every case), the right provisioning type for each workload, and the right backend storage for your scale and availability requirements. Fixed VHDX disks deliver the most consistent performance for production VMs, while differencing disks and dynamic provisioning offer flexibility in development and test environments. SMB 3.0 file share storage and Cluster Shared Volumes unlock highly available, live-migratable deployments, and Storage QoS ensures fair resource distribution across a multi-tenant host. As your storage needs grow, combining these primitives with Storage Spaces Direct and Scale-Out File Server gives you a software-defined storage platform that rivals dedicated SAN hardware at a fraction of the cost.