VHD vs. VHDX: Hmm….What’s the Difference

I get asked this all the time….and here is my answer. Microsoft’s virtual hard disk format, VHDX, has some important advantages over the legacy VHD format, as this VHD vs. VHDX comparison shows.

The release of Windows Server 2012 brought many new virtualization improvements, but one that caught the eye of many IT pros was the introduction of the VHDX file format. Windows Server 2012 supports the new format but also lets Hyper-V administrators use the legacy VHD format. With two virtual hard disk formats to choose from, let’s take a minute to talk about VHD vs. VHDX.

A look at VHD vs. VHDX

One of the biggest advantages of VHDX compared with the legacy VHD format is virtual disk storage capacity. Before Windows Server 2012, Hyper-V virtual hard disks had a 2 TB limit. VHDX files have a 64 TB capacity. The advantages of VHDX aren’t limited to improved capacity, however; VHDX files were designed to work with today’s modern hardware and have a 4 KB logical sector size that improves performance compared with VHD files.

The VHDX format also provides protection against file corruption related to power failures by continuously keeping track of updates in the metadata, a feature not available with the VHD format. Larger block sizes for dynamic and differencing disks, as well as the ability to store custom metadata, also give the new format the edge in the VHD vs. VHDX comparison.

Now let’s look at different storage types with VHD\VHDX. Hyper-V allows you to create 2 primary hard disk storage types, fixed or dynamic.
Dynamic size drives are allocated with the minimum space needed and space is expanded as you write additional drive to the volume. There is performance loss on disk writes that require storage to be expanded. For example, if you create a dynamic volume with 10 GB and as you write data and use up the entire 10GB allocation then the volume needs to be expanded first then your data will be written to the volume. This expansion adds overhead and can slow down data writes by 25% or more.

Fixed drive sizes presets the size for your storage. Since the file is preallocated on the Hyper-V host there is no loss in performance due to the need for expansion of space.
The big difference between VHD and VHDX is the way this expansion is handled. In tests performed by others, they have seen negligible difference in overhead with Dynamic VHDX volumes when they expand to accommodate additional data.
You can easily convert your VHD volumes to VHDX and vise visa. As always, make a backup and make sure you have enough time allocated for the conversion. The larger the volume, the longer the conversion will take.

Converting VHD to VHDX with Hyper-V
If you want to convert VHD files into VHDX file format, Hyper-V Manager console provides an easy way to do it. The way it works is it will create a new VHDX disk and copy the data from the existing VHD to the new disk. After it copies the data, you have two disks such as original VHD disk and new VHDX disk exactly with the same content. Once you confirm the newly generated VHDX disk is fully functional, you can opt for deleting old original VHD disk.

Now let’s see how we can convert VHD to VHDX.

  1. You cant convert a disk which is in use, so make sure you don’t have any virtual machines accessing the disk.
  2. Next step is to open the Hyper-V VM settings, go to the hard drive you want to convert. After selecting the disk which you want to convert, confirm it again. After confirming press Edit button.
  3. Go to the Locate Disk tab and select or enter the name and location of the existing VHD file.
  4. Then select a Choose Action tab and select Convert option as shown in the screenshot below
    .
  5. 5. In next step as shown in the screenshot below select the VHDX file format and click Next
    .
  6. Next step is to choose a disk type the new disk should be fixed size or dynamically expanding. Press Next to select the name and location of the new VHDX file format.
  7. Review the configuration in Summary Tab. And to finish, it will start operation for creating new VHDX file. This makes an exact copy of VHD file format as a new VHDX file. Now you can mount the new VHDX disk to the Hyper-V VM.
  8. Once you are satisfied with the operation of new VM with the new VHDX disk, then you can safely delete old VHD disk.
  9. You can use the same process to convert VHDX to VHD as converting VHD to VHDX disk.

First, it’s important to note that while you can create and use both formats with Windows Server 2012/R2, VHDX files are not compatible with Windows Server 2008. Microsoft recommends that most Windows Server 2012/R2 users upgrade VHD files to VHDX to take advantage of these benefits. However, if you expect you might want to move a VM to a previous version of Windows Server or Azure, it could be easier to keep your VHD files.

It is important to note, that the VHDX format is not supported in Microsoft Azure.  Hopefully, that will change soon, ya, you Hyper-V & Azure Team……. because building Hybrid clouds with VHDX is the way to go   🙂

Until next time, Rob…

Back to Basics….Hyper-V…What is it?

To start journey, one needs a foundation to start.  I assume everyone knows what a hyperviser is, but if you don’t check out Wikipedia.

VMware has been the leader for a number of years, along with another vendors and open source, like Xen and KVM. Microsoft also has a hand in Virtualization early on in the with Virtual Server, which was originally developed by Connectix, but no real traction and frankly it sucked..

For years, it had a bad rap compared to is competition until Hyper-V was introduced with Windows 2008.  Like any other product, it had it humble beginnings, but started to become a real threat.  With introduction of Windows 2012 and SMB 3.0, In my opinion, Hyper-V is as good, if not better than VMware’s ESXi. At this point, it is a numbers and education play.vmwarecompare Hyper-V

Hyper-V Overview (from Wikipedia with edits from me)

Hyper-V
Hyper-V implements isolation of virtual machines in terms of a partition. A partition is a logical unit of isolation, supported by the hypervisor, in which each guest operating system executes. A hypervisor instance has to have at least one parent partition, running a supported version of Windows Server (2008, 2008 R2, 2012 or 2012 R2).

The virtualization stack runs in the parent partition and has direct access to the hardware devices. The parent partition then creates the child partitions which host the guest OSs. A parent partition creates child partitions using the hypercall API, which is the application programming interface exposed by Hyper-V.

A child partition does not have access to the physical processor, nor does it handle its real interrupts. Instead, it has a virtual view of the processor and runs in Guest Virtual Address, which, depending on the configuration of the hypervisor, might not necessarily be the entire virtual address space.

Depending on VM configuration, Hyper-V may expose only a subset of the processors to each partition. The hypervisor handles the interrupts to the processor, and redirects them to the respective partition using a logical Synthetic Interrupt Controller (SynIC). Hyper-V can hardware accelerate the address translation of Guest Virtual Address-spaces by using second level address translation provided by the CPU, referred to as EPT on Intel and RVI (formerly NPT) on AMD.

Child partitions do not have direct access to hardware resources, but instead have a virtual view of the resources, in terms of virtual devices. Any request to the virtual devices is redirected via the VMBus to the devices in the parent partition, which will manage the requests. The VMBus is a logical channel which enables inter-partition communication. The response is also redirected via the VMBus. If the devices in the parent partition are also virtual devices, it will be redirected further until it reaches the parent partition, where it will gain access to the physical devices.

Parent partitions run a Virtualization Service Provider (VSP), which connects to the VMBus and handles device access requests from child partitions. Child partition virtual devices internally run a Virtualization Service Client (VSC), which redirect the request to VSPs in the parent partition via the VMBus. This entire process is transparent to the guest OS.

Virtual devices can also take advantage of a Windows Server Virtualization feature, named Enlightened I/O, for storage, networking and graphics subsystems, among others. Enlightened I/O is specialized virtualization-aware implementation of high level communication protocols like SCSI to take advantage of VMBus directly, that allows bypassing any device emulation layer. This makes the communication more efficient, but requires the guest OS to support Enlightened I/O.

Also, check out the below poster, this highlights all the current features of Hyper-V
Windows_Server_2012_Hyper-V_Architecture

Hyper-V Install

The easiest way to start using Hyper-V is by adding the Hyper-V role in Windows Server (2008 & later). Roles are the services that a server provides and features are what a server does and by default all roles and features are disabled when you do a clean install of Windows Server.

Having done that (which requires a reboot) you get the hyper-V manager when you expand the role and then connect to you server and you are ready to create or import virtual machines (VMs).

This is not the only way to run Hyper-V, there is free version of Hyper-v called Hyper-V server which you can download here. This is based on server core, an install time option in Windows Server (2008 & later) that is the bare minimum operating system with no real graphical interface, and is either managed from the command line (e.g. with PowerShell, DOS, netsh, diskpart etc.)or remotely. Hyper-V server is even more cut down, it has all of the roles and features removed except hyper-V and so you need be pretty good at command line stuff or know who to connect and setup the remote administration tools for Windows.

So having got a Hyper-V environment setup, you can then use the create new virtual machine wizard in the virtual machine manager to create new virtual machines. This process is similar to the way you would specify your requirements for a physical server except that you are telling the wizard which resources you are using on the physical server the VM will run on. You can also import a VM from an export created on a another Hyper-V environment or complete the wizard but use a VHD that you have got from somewhere e.g. there are some on Microsoft to save you having to install and configure a Microsoft application in order to evaluate it.

If you are creating a new virtual machine, then the virtual hard disk will be empty and will need an operating system. Theoretically This can be anything that runs on x86 x64 hardware form DOS 3.3 to Windows 8, or even other OS’s like Unix, and Linux. However Microsoft will only support it’s operating systems and applications that are supported to run on physical hardware e.g. Windows 7 and not Windows 95 which is out of support.

They word support here means you can get support from Microsoft and not a vague statement along the lines of “we got it to work but you’re on your own if you get stuck”. When it comes to Linux the latest versions of Red Hat SUSE and Centos are also supported because those distros have been made the subject of support arrangements between those Linux vendors and Microsoft so you can get support from Microsoft for them.

Take ake a test drive and see for yourself….

Until next time, Rob…