Let's take a look at Hyper‑V storage, and in particular,
I want to do a comparison contrast between Generation 1 virtual hard disks,
or VHDs, and Generation 2.
As a general rule, you think about the higher the number,
the more features and expandability, etc that you get, and that's true,
that's definitely the case.
However,
there are some wrinkles particularly with Azure that you need to know about.
First of all.
Let's see that we've got Generation 1.
These virtual hard disks can have either the VHD or VHDX extension.
Gen 2 disks can only do VHDX.
There is going to be a significant size difference between
Generation 1 and Generation 2 as you can see here.
Specifically,
Generation 1 disks have a 2 TB max size, and
Generation 2 VHDs have a 64 TB max size.
In terms of memory, 1 TB limit for Gen 1, 12 TB for Gen 2.
Generation 1 can handle 32 or 64‑bit VCPUs.
You can do up to 240 CPUs associated with the Gen 2 disk,
but that's 64‑bit only.
Now, that's an exam alert.
It's not a question of you necessarily having to memorize these numbers,
but no, for instance,
on AZ‑800 if you were to get a case study where they
mention 32 and 64‑bit architectures,
you're not going to be able to do Gen 2 storage on a 32‑bit virtual machine.
The way that the allocation units, that is how data is allocated to those VHDs,
512 bytes for Gen 1, which is really dates back to the early days of BIOS.
Nowadays, 4 KB is the standard allocation unit,
and you have that alignment by default in Generation 2 disks.
Speaking of firmware, Gen 1 is the old school BIOS,
whereas Generation 2 is UEFI, and that UEFI unlocks Secure Boot,
Trusted Platform Module,
and all of the latest and greatest hardware virtualization,
all of the controls that we expect and features that
we expect on modern motherboards.
By contrast, Gen 1, there is no security extension.
So summing up,
we could look at Gen 1 as being there for backward
compatibility with old systems and Gen 2 really being what we
should standardize on with our Hyper‑V VMs.
That having been said, we need to think about what Azure supports.
Now many Microsoft Azure VM role sizes support Generation 2 disks,
however, there is two important got‑yous on this slide.
You can do a Gen 2 VHD in Azure, but the VHD has to be fixed size,
not dynamically expanding, and it has to have the VHD file extension,
which means that in a migration scenario,
you may have some work to do to prepare those local VHDs or
VHDXs for upload to Azure if you're doing,
say, a lift and shift or if you want to create a VM image using a local copy.
Speaking of which,
you do need to know the PowerShell for converting Hyper‑V disks because
you may very well see it on AZ‑800 and even AZ‑801.
To prepare a dynamically expanding VHD,
you can do a compact operation that's Optimize‑VHD as you can see here,
and then you can actually resize a VHD very easily as long as the virtual
machine has stopped using the appropriate Resize‑VHD command.
You can also convert a dynamic Gen 2 disk to a fixed Gen 2 disk.
Now notice that it's not as easy as running a PowerShell
command to convert a Gen 2 disk to a Gen 1 disk,
that's not what we want to do.
We want to, in a migration scenario, stay with Gen 2 wherever possible,
especially now that Gen 2 is supported in Azure,
it's not supported universally,
but I dare say the majority of the Azure VM role sizes support Gen 2,
but in this case, in this example,
we're doing Convert‑VHD to convert our winserv01.vhdx file to a VHD copy,
and notice that we're also turning off dynamic expansion.
We need to have the VHD type set to fixed. Now let's do a demo.