Hello, Cloud Gurus,
and welcome back for this lesson
where we're going to take a look at
Configuring Hyper-V Virtual Machine Storage.
Let's take a look at what we're going to cover.
First up, we'll cover off the virtual hard disk formats.
We'll take a look at the virtual hard disk types.
We'll cover checkpoints,
also referred to as snapshots in older versions of Hyper-V,
and then we'll take a brief look
at virtual machine availability and performance,
and then we'll wrap up with a demo
where we will configure Hyper-V storage.
Let's dive in.
Now, virtual machines use virtual hard disks,
or VHDs, for their storage,
and when you create a virtual hard disk for a Hyper-V VM,
you have a few important decisions to make.
The first decision you'll need to make
is the format you want to use for your virtual hard disk.
The first format is the VHD format
that shipped with Hyper-V in Windows Server 2008,
and it's really only used to support
older versions of Hyper-V now
and supports virtual hard disks
up to 2,040 gigabytes in size,
and then with the release of Windows Server 2012,
we got a new and improved VHD format, which is VHDX,
and VHDX provides support for virtual hard disks
up to 64 terabytes and it has additional protection
against corruption due to power failure.
It also supports the ability to extend
or shrink the hard disk while the VM is running
when the virtual hard disk is connected
to a virtual SCSI controller,
and the VHDX format is supported on generation 1 VMs
and is required on generation 2 VMs,
and then with Windows Server 2016,
we got the newer VHD Sets,
which supports sharing a VHD between multiple VMs,
and it uses a VHDS file and a separate checkpoint VHDX file,
and VHD Sets have replaced the shared VHDX
that was available on earlier versions of Windows Server.
Now, before we got VHD Sets or even shared VHDX,
we used to have to expose our storage area network, or SAN,
to our virtual machines to provide access to a shared disk
and this required some complicated networking.
Shared VHDs via VHD Sets have made this much less painful.
Now, shared VHDs require Windows 10 or later
and shared storage connected to the Hyper-V host.
The next decision you'll need to make is the disk type,
and the disk type determines how the virtual disk
is written to the physical storage.
There are 3 disk types to be aware of.
Let's take a look at them.
The first are dynamically expanding disks.
With this disk type,
you specify a minimum and maximum storage size.
The virtual hard disk is created
on the physical disk at the minimum size and is,
as you would expect, dynamically expanded up
until it reaches the maximum size,
and this is great when you're not sure how much disk space
to allocate to your virtual machines,
but because the storage can be fragmented
as it's written to disk
and you can over-allocate the storage,
it can lead to performance and availability issues
as the disks grow.
The next disk type and, in my experience,
probably the most common production disk type,
are fixed disks.
With a fixed disk, you set a specific size for the disk
and it is immediately written to the storage at that size.
This resolves potential issues
around dynamically expanding disks
but at the cost of potential wasted space.
In the real world, though, this might not matter as much
as solid-state storage often removes
all of the negative effects of fragmentation
and thin provision storage area networks
might fragment the data anyway.
The final disk type to be aware of are differencing disks
and these would have to be one of my favorite.
They allow you to create a parent-child relationship
between 2 disks where the parent disk is read-only
and any changes to the disk are written
to a child differencing disk.
What's great about this type of disk
is that when you have multiple virtual machines
that share a common base image,
like the Windows operating system,
you can save on disk space, and if you're clever about it,
you can even place the parent disk
on really, really fast storage
and significantly boost the performance
of a large number of virtual machines.
Now, checkpoints allow you to capture the state
of a virtual machine at a point in time,
and checkpoints are sometimes referred to by their old name,
which was snapshots.
There are 2 types of checkpoints.
They are standard checkpoints and production checkpoints.
Standard checkpoints create a point-in-time snapshot of a VM
by creating a differencing disk
and saving the running VM state to a file.
If the VM is not running,
only a differencing disk is required.
The problem with standard checkpoints
is that a running virtual machine
might not know its state is being captured
and might be halfway through
doing something really important,
like writing a file or writing to a database.
So standard checkpoints are great for testing,
but they can easily lead to issues like corruption.
Therefore, it's recommended to use production checkpoints.
Production checkpoints notify the VM guest operating system
that the state of the VM is about to be captured
so it can prepare by pausing in-progress writes
for a brief moment.
These checkpoints work the same as backup technology
and are supported and recommended
on all production workloads,
especially for things like Active Directory and SQL Server.
Now, to improve the performance
and availability of your virtual machines,
you have a few options,
and I don't expect these to be
heavily focused on in the exam,
so let's take a high-level look at the options available
so you can choose an appropriate technology as required.
The first option to be aware of
is to cluster your Hyper-V hosts.
This involves deploying a Windows Server failover cluster
and running highly available virtual machines
on that failover cluster.
Windows Server failover clustering requires shared storage
and you can create a Clustered Shared Volume, or CSV,
to host your virtual machines,
or you can use Server Message Block, or SMB, 3
to host your virtual machines,
and you also ideally need a minimum of 2 network adapters,
both a private and a public network,
for your Windows Server failover cluster,
and you can also run Windows Server failover clusters
within guest virtual machines on your Hyper-V hosts.
This provides not only protection
against the failure of a Hyper-V host
but also the failure of a guest VM,
and you can do this with shared storage
directly attached to the VM
from a storage area network, or SAN,
or you can use shared VHDX or VHD Sets,
and deploying a cluster in your virtual machines
on a Hyper-V host is referred to as guest clustering.
Another option to provide high availability
is Hyper-V Replica.
Hyper-V Replica works by replicating a virtual machine
between two Hyper-V hosts
and this can be done over a slower wide area network.
It works by performing initial replication
and then storing changes in a VHD file
and replaying those changes
on the destination replica virtual machine.
You can also choose to keep additional recovery points
of the virtual machine at the destination,
and these recovery points can be application consistent,
and to ensure that your VMs use storage in a way
that is friendly to the neighboring virtual machines
running on the same host,
you can use Storage Quality of Service, or QoS,
to configure either a minimum or maximum I/O per second,
or IOPS, for each virtual hard disk attached to a VM.
All right, let's take a look at a demo
of configuring Hyper-V storage.
In this demo, we have our existing Hyper-V server,
CORP-BNE-HV01, and an existing virtual machine.
In this demo, we will create a new virtual hard disk
and attach it to the VM.
We'll also explore Storage Quality of Service,
and then we'll explore checkpoints,
including configuring checkpoint settings
and creating and managing checkpoints.
Let's take a look.
All right, so here we are on our Hyper-V server
and I've gone ahead and opened Hyper-V Manager.
I just wanted to show you the virtual machine
that we've got created here, so I'll just select this VM,
and you can see here we have a generation 2 virtual machine.
This is important because we're going to start
this virtual machine and then we'll go ahead
and create a new virtual hard disk
and then we'll attach this virtual hard disk
to the running VM.
So I'll just right-click this virtual machine
and select Start and we'll leave that running
in the background.
Now let's go ahead and create a new virtual hard disk.
So I'll select New and then Hard Disk.
We'll go ahead and hit Next on the welcome screen.
Because we're running a generation 2 virtual machine
and we want to attach it
to a virtual machine that's running,
we're going to use the VHDX format,
so we'll go ahead and select Next.
We have a few options for the virtual hard disk type
that we want to use, as we discussed in the lesson.
I'm going to go ahead and use a dynamically expanding disk,
so I'll go ahead and click Next.
Now we need to provide a location for our virtual hard disk
and this has to be a disk that is attached
to our Hyper-V host.
I'm going to use the default location
and I'm just going to name this disk Data Disk.
Now, this location could be shared storage,
like a storage area network, but in our case,
we're just using the C drive on our Hyper-V host.
I'll go ahead and hit Next,
and now we need to provide a maximum size
for our dynamically expanding disk.
I'm going to go ahead and provide
40 gigabytes as the maximum size,
and then we can go ahead and click Next,
and then we can go ahead and hit Finish.
All right, our virtual hard disk has now been created.
Now let's go ahead and attach the virtual hard disk
to our virtual machine.
We'll right-click the virtual machine and select Settings
and then we'll navigate to the SCSI Controller,
and we'll select the type of hardware that we want to add,
which is a hard drive, and then we'll select Add,
and then we'll browse out for our virtual hard disk.
We can see our new Data Disk that it's created,
and even though we specified 40 gigabytes as the size,
because it's dynamically expanding,
it's only using about 4 megabytes on disk.
So we'll go ahead and select our new Data Disk
and then go Open.
Now I'm just going to expand
this little node here next to the hard disk
so I can show you the storage IOPS.
Just expand this node,
and then we'll go to Quality of Service
and I'm going to enable Quality of Service on this Data Disk
and I'm going to set a maximum IOPS of 120,
which is about the amount you get
on a traditional spinning hard drive,
and then we can go ahead and click Apply
to attach that disk.
Now the next step would be to bring that disk
online in the operating system
using something like disk management,
but we're not going to take a look at that in this lesson.
We'll take a look at that in an upcoming lesson
where we look at storage.
Now let's take a look at checkpoints.
So if I navigate down to Checkpoints under Management,
we can see that we have the checkpoint options available
that we discussed in the lesson,
including production checkpoints and standard checkpoints,
and if we wanted to make sure this virtual machine
only ever took production checkpoints,
we could uncheck the box to create standard checkpoints
where production checkpoints are not possible,
or we could just limit this virtual machine
to taking standard checkpoints,
and we can also enable automatic checkpoints,
which will take a checkpoint
whenever a virtual machine starts.
We're okay to use production checkpoints
and standard checkpoints as a backup,
so we'll go ahead and click OK on this.
Now let's checkpoint a virtual machine.
We'll right-click our virtual machine
and then we'll select Checkpoint,
and because the host was not able
to create a production checkpoint for this virtual machine,
it's gone ahead and created a standard checkpoint
and that's because there's no operating system running
inside this virtual machine yet.
So I'm going to go ahead and click OK,
and we can see we have our checkpoint listed here
and we can rename our checkpoint if required,
and we can also delete the checkpoint
and delete the checkpoint subtree,
and when you delete the checkpoint,
it basically doesn't allow you
to revert back to this point in time,
and when you delete the checkpoint subtree,
it deletes the checkpoint itself
and all future checkpoints
that were based off this checkpoint.
All right, that's all I wanted to show you in this demo.
Let's wrap up with a bit of a summary
of what we've covered in this lesson.
All right, so what have we covered?
You can use VHD Sets to share disks
between virtual machines,
which is great for things like guest clustering,
and you can use differencing disks
or dynamically expanding disks
to conserve disk space on your Hyper-V host,
and you can use production checkpoints
to ensure a VM is aware that a checkpoint is being taken
so it can prepare for an application-consistent checkpoint
which will avoid issues like database corruption,
and you can use both host and guest clusters
to improve the availability of your virtual machines
and the services that run on them,
and you can combine both a host cluster
and a guest cluster for maximum availability,
and you can use Hyper-V Replica
to replicate a virtual machine between two Hyper-V hosts,
even over slower networks like a wide area network.
All right, that wraps up this lesson.
Thanks for being with me.
I hope you found it useful and I look forward
to seeing you in the next lesson.