Dealing with VHDX files
Modern Art
Hyper-V virtual hard disk (VHDX) files not only have more capacity than the standard VHD files, they are also far less likely to be corrupted as the result of a server failure or hard reset. VHD files can be destroyed very quickly when the host system encounters problems – but not so with VHDX files. If you use Windows Server 2012, you normally create VHD files as an iSCSI target; Windows Server 2012 already supports VHDX files but can only use them with Hyper-V, not iSCSI, targets.
Now Available for iSCSI
The new Windows Server 2012 R2, however, can use VHDX disks as iSCSI targets. The VHDX hard drives you create also can be managed directly in the System Center products as of Windows Server 2012 R2 and System Center 2012 R2. Windows Server 2012 R2 provides the option of assigning the disk to multiple virtual servers. Shared VHDX technology primarily offers benefits in operations with Hyper-V R2 2012.
Also new in Windows Server 2012 R2 is the option to change the size of virtual hard disks on the fly, but you need to shut down the associated virtual server in Windows Server 2012. Also, you can now export and copy virtual servers on the fly in Windows Server 2012 R2.
Using VHDX Files
To manage virtual hard disks outside of Hyper-V, right-click Disk Management and choose Create VHD , which starts the wizard. In the wizard, you need to decide where you want to save the VHDX file on your hard drive and what size the hard disk should be. At this point, you also determine whether the disk can grow or whether you want to use a fixed size.
If you select Attach VHD , you can connect an existing disk to the computer (Figure 1). You can double-click a VHD(X) file to this, too. After you have created the virtual hard disk, Windows displays it in Disk Management, and you can manage it like any other disk.
If you still use VHD files, you can convert these to VHDX files with the Hyper-V Manager or the Convert-VHD
PowerShell cmdlet. In Hyper-V Manager, click the Edit Disk
action to launch the corresponding wizard. Load the VHD file and start the conversion in the wizard by choosing Convert
.
Converting
In the scope of the conversion, you can select the disk format and also change the disk type (i.e., Fixed size
or Dynamically expanding
). The Convert-VHD
cmdlet is available after installing Hyper-V on Windows 8, as well.
One of the advantages of cmdlets is the ability not just to convert files VHD files to VHDX files but also to convert the opposite direction. Thus, you can benefit from the advantages of the new format but revert in case of emergency (e.g., you need to mount a virtual hard disk on another system some time later). The syntax is very simple:
Convert-VHD -Path <Path to VHD(X) file> -DestinationPath <path to target file>
It is also possible to change the type of hard disk, for example, to a differencing disk:
Convert-VHD -Path <Path to VHD/VHDX file> -DestinationPath <target path and file> -VHDType Differencing -ParentPath <parent disk>
or a dynamic disk:
Convert-VHD -Path hd1.vhd -DestinationPath hd1.vhdx -VHDType Dynamic
You will find all the options for this cmdlet on Microsoft's TechNet site [1]. Besides using PowerShell to convert hard disk formats, you can customize the hard disk size with the Resize-VHD
cmdlet:
Resize-VHD -Path c:\vm\owa.vhdx -SizeBytes 1TB
In addition to these special tasks, you can simply use New-VHD
to create new disks and Get-VHD
to display information about the hard disks. Virtual hard disks can be connected directly to virtual servers in PowerShell with:
Add-VMHardDiskDrive -VMName <VM> -Path <VHDX file>
Of course, you can connect virtual hard drives to the host system. For example, to copy data and integrate it with the virtual server, issue:
Mount-VHD <VHD file>
The Dismount-VHD
cmdlet disconnects the virtual disk from the system.
Microsoft helps administrators migrate virtual servers from VMware vSphere to Hyper-V with the free Microsoft Virtual Machine Converter [2]. The current version is already optimized for Windows Server 2012 and Hyper-V Server 2012, but it does not support the new VHDX disk format of Windows Server 2012 as yet.
However, with Hyper-V Manager – or with Convert-VHD
– you can convert the VHD file that is created to a VHDX disk. System Center Virtual Machine Manager 2012 with SP1 can convert VHDX hard disks from Hyper-V 3.0 and VHD files to VHDX format.