Microsoft Azure AZ-800 — Section 11: Manage Hyper-V and guest virtual machines Part 5

Microsoft Azure AZ-800 — Section 11: Manage Hyper-V and guest virtual machines Part 5

90. Manage VM Checkpoints

I now like to talk to you about a feature that can definitely be very helpful for us when working with Hyper-V, especially when testing things out and making configuration changes that can take a long time that you might perhaps need to revert. This a feature known as checkpoints.

Now, checkpoints used to be called snapshots back in the early days of Hyper-V, and then eventually Microsoft changed the name to checkpoints. And essentially, it’s it’s basically the same concept with a checkpoint. Essentially, what happens is you can create this little thing called a different thing disk, a different thing. Disk is going to be a new virtual hard drive that will essentially store all new data in it.

So, if you think about it, you have a virtual hard drive that all of your data is stored in to for your virtual machine. And when you create a checkpoint, it creates this little thing called a different thing disk, which is another file to store all your data in. And the idea is, if you break something, something’s not working right, you can revert back to the other, the old hard drive.

Now you may say, well, what happens to the old hard drive when I do create a checkpoint? Well, the old hard drive is still in place, but it becomes read only in the new virtual hard drive. The new a different thing disk is now what gets written to. And this how checkpoints work.

Now, keep in mind you really in a production environment, you do need to understand that when you create checkpoints, you are hurting your performance. When you use a different disk to when checkpoints are created and it creates what’s called a difference in disk. It is going to hurt your performance. You and the other thing is, the more of those you create, the slower things are going to go. In fact, I I remember helping a company a while back and they couldn’t figure out why one of their virtual machines was so slow and they could barely do anything on it.

So, I took a look at their Hyper-V environment. They had like 15 checkpoints stacked on top of each other.

So what happens is you start out with a parent HD apparent virtual hard drive. You create a checkpoint. It creates a different thing that then ties back to that virtual hard drive. Then you create another checkpoint and it ties back to the previous checkpoint. The previous checkpoint comes read only. Then you create another one, and then that. Previous the previous virtual hard drive. The difference in this becomes read only and they’re all you know you’ve got a parent, child, child, child, child, child relationship, and it all drive draws back to that original parent. And it really, really slows things down.

So you do want to kind of limit how deep you go with this. And then another thing to consider is that you can merge your checkpoints later down the road.

So, Ideally, if you think about it like this, OK, I’ve got a server that I’m going to be adding some configuration to making some changes to, and I’m really concerned that something could get broken or corrupted whenever I do this.

So that is a perfect opportunity for you to create a checkpoint.

So, I create the checkpoint and I make the configuration changes. Let’s say it takes a couple of hours to get everything going and oh no, everything broke. It didn’t work right. I can now very quickly, within just a matter of a couple of minutes, everything can be reverted back to the way things were before I started making these configuration changes because I can revert back to that checkpoint.

Now, if everything goes through smoothly and we don’t have any problems, then at that point what I would want to do is merge the checkpoint. And what can I can do then is I could merge it back into the virtual hard drive and then you won’t take that performance hit anymore.

OK.

So, I want to show you now a little bit about the configuration of checkpoints. And the first thing we’re going to do is just look and see where our virtual hard drive is.

So as we go to create a checkpoint, you can see where the new checkpoint is created.

So, I’m going to take a look here on N.Y.C. server one going to right click that click settings. I’m going to go down to where it says hard drive. And then from there you can see the location see and slash VM slash movie HD Files NYC server one. And you can see the location of it. I can even click, inspect and inspect will tell me the type of virtual hard drive it is dynamically expanding, which means that it can expand to a certain size if we need it to. But that’s a pretty common type of virtual hard drive people will use. Let’s go look at where that’s at on the hard drive.

Now, if I pull up my file explorer, you can see the virtual hard drive is stored right here.

OK.

So, I can see the size and all that stuff that goes with it. All right.

So nothing special. I’ve got the four virtual hard drives for the four four virtual machines that I’ve got inside my Hyper-V right now, even though I’m only really using these two in this in these demonstrations.

OK, so now what I’m going to do is right click the server and go to settings and we’re going to come down here to check points and we’re going to turn on the checkpoint feature.

OK, so, I turned it off, so, I wanted to turn it on.

So let’s take a look at what it says, it says select the type of checkpoint that will be created when users choose to checkpoint this virtual machine, yet production checkpoints, I tell you these are user backups for your guest operating systems to create data consistent checkpoints. They include information about running applications. It also tells you to create standard checkpoints if the guest does not support creation of production checkpoints.

Now what this, this going to be used in conjunction with the ability of dealing with things like databases and all that. In the past, that would generally tell you with application databases and stuff, you should never create checkpoints. But if you’re if the type of application you’re running inside of a virtual machine is checkpoint aware, that means it can support production checkpoints and you can you can feel comforTable using that. But you would definitely want to research whatever application you’re using as a database application or something on your virtual machine and make sure that it works or that you don’t really have any problems with this. If your database is only on a single machine, it’s if you’ve got some kind of replication going, then that’s when you want to make sure that your applications are aware of checkpoints like domain controllers didn’t used to be in. The main controls are now aware of checkpoints.

So then you’ve got stainer checkpoints that you can go with, and they tell you it creates application system checkpoints that capture the current state of the applications. And this the older, the older style. If you’re working with with a type of application that does not support what’s called production checkpoints and can’t provide a production application information into the checkpoint, then that’s the one you would go with. You can also do use automatic checkpoints. And so an automatic checkpoint is where it will periodically has the ability to periodically trigger a checkpoint to be created. The applications itself can do that as well. I’m going to turn that off. I don’t actually want that. I don’t want it automatically creating it. I’m going to make it where I can manually do it.

OK, so from there, it says, where do you want the checkpoint files to be stored and it’s going to stored in this VM files folder right here? OK.

So, if I wanted to specify a different place, I could do that right here. Specify a different folder. I could, but I’m going to click OK and I’m going to go into my virtual machine or actually let me create a checkpoint. First, I’m going to right click and then click to create a checkpoint. All right. And you’re going to notice that it’s creating the checkpoint very quickly. It doesn’t take a whole lot of time to do this. And then once the checkpoint is created, it basically is creating a little different disk, which just takes a few seconds. And at that point, the checkpoint has been created. All right. They tell you the backup technology in the guest operating system user to create a production checkpoint running application state wasn’t included in the checkpoint. That’s because I don’t have any applications that are actually running on the server so that are checkpoint aware.

So no big deal.

So you can see that this the checkpoint right here, the time and date. And then we’re currently in the now. This where we are now.

So, if we come into here and click on our server here, I’ve created a little folder for demonstration purposes called the most important data in the world and. It says the ultimate question of life, the universe and everything, so this very important datand I am going to delete this one stored in the recycling bin and I’m going to empty the recycling bin. And oh no, all of our data is now officially gone. All right, including that life, the universe and everything answer that we all want to know, right? So that’s done.

Now we’re going to do is we’re going to revert.

So, we’re just going to right click and we’re going to click to revert. Or if you want to right click the check point, you can do that as well as they apply. Either way, you can do that. Are you sure you want to apply this checkpoint? Say yes, apply.

OK, at that point, it is now going to shut the virtual machine down. And if I want, I can go ahead and you’ll notice it’s turned off. I’m just going to start it back up and I’ll pulse a video while it’s starting. All right.

So now that my server has been rebooted, I want to show you where the checkpoint hard drive is here, so, I’m going to click my file export. I want you to notice that this the checkpoint right here. And instead of getting a V HD or V HD X extension, it’s an a v HD X extension. And so that’s how, you know, that’s a checkpoint.

So for what is going to happen now is every new change that I make to my server. It’s going to store everything in this location here, the Aviate, the X file and this file here is now read only.

So, it reads it, but everything is written here. This called a different thing disk.

OK, so jumping back over into Hyper-V here we’re going to connect to the machine. All right.

So here it is, and I want you to notice that the folder that was deleted is now back. Most important data in the world and. The ultimate question of life, the universe and everything, I’m sure you all want to know what’s in this file, don’t you? Well, here you go. Drum roll. The secret is the number 42.

So there you go. That is the ultimate question to the life of the universe and everything. All right.

So, we got her. We got our very important data back now and in, you know, if I would have made a bunch of configuration changes like installed a bunch of stuff, right, and installed a bunch of stuff, it would just go all right back to the way things work because you reverting back to that other that other drive.

OK, now what if you decide you want? You’re happy with the changes and you don’t want to keep the checkpoint because the checkpoint? Might slow you down, which it will the more, especially if you create more checkpoints on top of this.

So, it’s going to keep going down this tree hierarchy like this if you do that. And the more checkpoints you create, the slower things are going to get.

So what you’re going to want to do is merge your checkpoint in the way you’re going to do that is if you click on the server, you’re going to click Edit Disk, you’re going to click next and you’re going to locate the checkpoint. Follow the latest checkpoint file.

OK, so you go there. Here it is. Right here I’ve only got one checkpoint file, so here it is. I would click open on that and then I would click next and then I’ll click Merge and they don’t click next. And that’s how you’re going to do it.

OK, I actually want to keep my checkpoint, but that is how you can merge checkpoints and even merge each checkpoint with the previous checkpoint until you get down to the root. Eventually, everything’s going to be merged together and you’ll no longer have checkpoints. You have that just just a virtual hard drive itself, and you’ll have better performance.

OK. Also, you can do this from PowerShell.

So right here there’s a Checkpoint -VM command. Well, here’s a little article on it. If you wanted to do this with PowerShell, you can see you could use this command here checkpoint -of name test snapshot name, which again, they used to call it snapshots. That’s the reason that parameters there. But ultimately, that’s how you can create checkpoints you using PowerShell. All in all, checkpoints are pretty straightforward feature, and they definitely can assist you in the real world.

So, I highly recommend using them. But I also highly recommend merging check points after you have completed whatever you’re working on.

91. Implement high availability for virtual machines

Now, one of our considerations with Hyper-V is the concern of fell over. Essentially, you’ve got to imagine if you’ve got a couple of virtual machines that you’re working on and you know, these are maybe these are high priority virtual machines that are important to your environment and you’re concerned about a virtual machine crashing or something happening to the server. And you need to make sure that we have a way to keep the virtual machines up and running, even when a server could fail.

So, for example, perhaps I’ve got a virtual machine here on NY C Server one, and I want to make it where if NYC Server one, which is hosting Hyper-V, if it was to fail, I would maybe want it to fail over to my other server, which in this case would be NYC DC one.

So, I’ve actually got NYC Server one, I’ve got NYC DC one. I’ve got Hyper-V installed on both of the machines.

OK, here’s Hyper-V.

OK, let’s just set up a VM here. Click New Virtual Machine was going to create a VM just to kind of demonstrate here. Next, I’ll just call it VM one. And I’m going to click finish, it’s just going to generate a VM real quick, there’s nothing in the VM at the moment, right? But let’s say that I wanted that virtual machine to be able to fail over to if something were to happen to this physical machine. I want users who may be more connected into that VM to fail over to the other virtual machine.

So the first thing you can do if this virtual machine is running actual server operating system. You could actually create another virtual machine on NYC Desk one and install server on it, and you could you could do what’s called failover clustering between the two VMS, which I’m not getting into failover clustering right now. I just wanted to point that out that if you were, you were on a server, you could actually go to server manager. Manage our own feature, so you’d have to do this on the actual server VMS themselves, but you could install failover clustering on on the server.

So here’s failover clustering right here, which again not getting into that right now, but that would be an option if you were to install failover clustering. Ultimately, though, what I want to show you how to do what we’re kind of focused on here is the ability to use what’s called Hyper-V replica.

So, I’ll show you a little bit about Hyper-V replicas now.

OK, so, we’ll look over to the right here and I’ve got Hyper-V settings. I’m going to click on Hyper-V settings and come down here to assess replication configuration. You’ll notice that Hyper-V replication is not turned on by default, So, we’re going to go ahead and turn this on. It’s going to give us two options for the authentication side of replication.

So your Hyper-V on NYC server one would have to authenticate with your Hyper-V on NYC DC one.

So, I would want to enable one of these options here. Most people just go with Kerberos, they’ll use a Kerberos, but Kerberos is going to use HTP, So, it’s not going to be encrypting everything over its data sent over. The network will not be encrypted. As you can see, it’ll be using Port 80.

So generally speaking, you would want to use a digital certificate with this.

So you need to set up a certificate authority and you would need to issue a certificate, which you can do that through server manager, manager roles and features, and then install Active Directory certificate services, which I’m not getting into all the certificate stuff in this particular video. But you could do that and then you have a certificate that would allow you to do HD TPS. The next thing is you have to authorize the storage of where this going to be.

So, so specify the servers that are allowed to replicate virtual machines to this.

So, I could say allow replication from any authenticated server or allow replication from a specific from a specified server. And so at that point, I could click add and then I could I could put in, you know, the computer and stuff that I want to I want to use there are I’ll just to any which means I’m going to replicate with any.

OK, so, in this case, if you are going to authenticate with any server that supports authentication, you can choose that top option if you want to choose specific machines. You could choose the second option here, OK, if you again if you choose a second option to specify the primary server.

So you can use wildcard for the fully qualified domain of the primary server.

So maybe I’m going to be the primary server and then at that point.

So specify the default location for the store replica files. That’s it’s going to be the default location or your virtual hard drive files and then specify the trust group that tell you the trust group is going to have a group of primary servers with which give it a primary virtual machine can move. All right.

So, I could specify a group name for these servers in my case.

So, I am going to allow replication from any think eight server, which means Hyper-V on NYC DC one Hyper-V on NYC Server one, they’re part of the same domain. They both support Kerberos and they should be able authenticate with each other and replication would be allowed. At that point. I can click OK. All right. And it tells you that you need to configure the firewall to allow inbound traffic so as ensure inbound TCP exception for Port 80, enable the firewall if you’re using Windows Firewall.

So let’s go take a look at our firewall now.

OK, so going down the server manager, going to ols, going to Windows Defender firewall with advanced security, OK, we’re going to go to inbound rules. We’re going to right click email rules, click new rule. You get a predefined and there is a rule called Hyper-V Replica HDTV.

So, we’re going to select that. We’re going to click next, select this. We’re going to allow this next and say, Allow this connection. Click finish. And we’ve now added that rule.

OK.

So keep in mind, we’re going to have to do the exact same thing over on our other server.

OK.

So, we’re just going to go ahead and click, OK, get out of all that and we’re going to jump over to NYC DC one now.

So here we are on NYC, DC one, and we’re going to go over here to Hyper-V settings. We’re going to go down here to replicate the configuration and enable this set this to enable use Kerberos and allow replication right here. Going to go ahead and click, OK. This tells you the same thing, so, we’ll click OK. Two that will go into server manager tools. Windows Defender Firewall with advanced security, right click inbound and new rule. Predefined, and we’re going to go with Hyper-V replica. Click next select the listener for the role in next and then allow finish.

So now allow that on the firewall.

OK, so at that point, we have set up all the prerequisites that are needed in order to support the Hyper-V replica.

Now I’m going to jump back over to NYC Server one and I have my little play VM here that I created, and I’m going to right click this VM and I’m going to click to enable replication. From there, we’re going to click next and we’re going to choose the replica server again, we’re at NYC Server one, we’re going to point to NYC DC one, I’m going say NYC DC one and we’re going to click check names, OK, and it’s contacting Active Directory and is going to verify that the name is valid. Once I see them on the click, OK, and I could see one is there, we’re going to click next. It’s verifying the configuration is just making sure everything checked out. We’re using Kerberos authentication. It also asks for one to compress the data that’s being transmitted over the network. This going to take a little bit more processing power, but it’s going to speed up network performance. Then we’re going to click next, says, OK, you’re going to store the virtual hard drive on sequel and so should be HD ADHD.

So should be m one point forty X, which yes, that is where we’re going to be.

So, Is it clear the check box of any virtual machine hard drives that you do not want to replicate? We do want to replicate this, so, we are going to select this. We’re going to click next. How frequently do you want it to replicate? You can have it. Do it every 30 seconds, every five minutes, every 15 minutes. Five minutes is the default. I’m going to say every 30 seconds.

OK, they were going to click next. Says, All right, you can choose to store only the latest recovery point of the primary virtual machine to the rep the server or to add additional recovery points, allowing you to recover to an earlier point in time. This additional. Recovery points require more storage and processing, so you can figure additional recovery points, so maintain only the latest recovery points or create additional recovery points.

So this makes it where basically I can have a replica that goes out where basically, if I want to have a backup copy from, say, like twenty four hours prior, I could do that if I wanted. You also can utilize volume shadow copies.

So this sort of a way of delaying replication of virtual machine for backup purposes. But I’m going to do the latest because I’m using this for high availability, which is what we’re learning. We’re learning high availability for this.

So, I’m going to click next. And then from there, it says before application can start, an initial copy of all virtual hard hard tests that you’ve selected must be transmitted to the replica server size of the initial copy of the selected virtual hard disk four megabytes initial replication method send the initial copy over the internet. I’m sorry over the network or send the initial copy using existing media if I wanted to to make it work doesn’t have to replicate this whole virtual hard drive right now. If I want to just maybe I’ve got it stored on a flash drive, I can move it manually. Maybe, I just want to conserve bandwidth on the network. That’s what that option is going to do, says use an existing virtual machine on the replica server as the initial copy. There was already a copy over there.

Somehow all of this that I could go ahead and use, that I could say start replication immediately or I could schedule it to start on a certain date in time.

So that’s what these options are. Then I’m going to click next. And at that point, I’m ready to click finish. All right, So, it’s now going through the process of replicating, and I’m going to go ahead and let that run through. It’ll take just a bit, as you can see, merging says merging and process. By the way, I didn’t start the virtual machine, but the virtual machine could be started. When you do the replication as well, you don’t necessarily have to shut the virtual machine down, order to do replication just so you know. All right, let’s jump over now to NYC DC one. Here’s NYC, D.C. one and pulling up there it is, virtual event one is now set up and we have officially set up Réplication. We clicked on this replication Tab and you can see the replication is coming from NYC server one. And so all of that is up and running. And so now we’ve got the ability to use it.

So what’s interesting about this, too, is I can have a user who is remotely connected into NYC Server one. And if NYC Server one was to fail, this user can be redirected to the NYC DC one version of VM one as well.

So, we have the ability to provide a replica in that replica is now up and running, and we’ve provided some high availability for our server. Keep in mind, all of this could also be configured through PowerShell as well. There are PowerShell commands for every bit of this.