March 1, 2017
Creating and Configuring VMs in Windows Server 2016 Hyper-V
In the previous posts, we walked through the initial configuration of our Windows Server 2016 Hyper-V server. This included installation, administration, storage settings, network configuration, and remote management. The point of setting up the Windows Server 2016 Hyper-V hypervisor is to host virtual machines. Thus, let’s explore how to create and configure VMs in Windows Server 2016 Hyper-V.
See a complete walkthrough in our video tutorial:
Creating a New VM
First, you need to use the Hyper-V manager to connect to the Hyper-V host. The Hyper-V manager is included in the Remote Server Administration Tools (RSAT; a separate download) for client operating systems such as Windows 10, or included in the Server Manager “install features” section of Windows Server 2016.
To begin, right-click your Hyper-V host and select New > VM.
This launches the New Virtual Machine Wizard.
Begin the configuration by selecting a name for your VM.
Generation of the VM
Next, you are asked to select the Generation of the VM. There are two choices here: Generation 1 and Generation 2. What are the differences?
To start with, Generation-2 VMs are only compatible with Hyper-V versions 2012 R2 and later. Furthermore, Windows Server 2012/Windows 8 64-bit and above are supported with Generation-2; 32-bit versions of those operating systems do not work. In fact, if you create a Generation-2 VM and try to boot from an ISO of a 32-bit OS, you receive an error stating that no boot media can be found. Microsoft has also been working on support of Generation-2 VMs with Linux. Be sure to check with your particular distribution, as currently not all are supported with Generation 2. There is one more consideration: for those thinking of moving a previously-created Hyper-V VM to Azure, Generation 2 is not supported.
For greater compatibility including moving to Azure, Generation 1 VMs should be selected. If none of the limitations mentioned are true, and you want to utilize such features as UEFI secure boot, then Generation 2 would be the preferred choice.
Once a VM is created, you cannot change the Generation. Make sure you choose the right Generation before proceeding.
Memory Management in Hyper-V
The next configuration section is where we can Assign Memory.
The memory management in Hyper-V has an option called Dynamic Memory; you can see the checkbox that can be selected to enable the feature at this stage. If you choose to enable this option, Hyper-V cooperates with the VM guest operating system in managing guest operating system memory.
Using the “hot add” feature, Hyper-V expands the guest operating system memory as memory demands increase within the guest. Dynamic Memory helps to dynamically and automatically divide RAM between running VMs, reassigning memory based on changes in their resource demands. This helps to provide more efficient use of memory resources on a Hyper-V host as well as greater VM density.
When you select Use Dynamic Memory for this virtual machine, you can set minimum and maximum values for the RAM that is dynamically assigned to the VM.
The next step in our VM configuration is to Configuring Networking. In order for a particular VM to have connectivity to the network, you must attach a virtual switch that is connected. You can also leave a VM in a disconnected state; connection to a network is not a requirement in completing VM configuration. In this example, we are connecting the VM to the ExternalSwitch, which is a virtual switch connected with the production LAN.
Hard Disk Configuration
The next step is configuring the hard disk that is assigned to your VM. There are three options that you can choose from:
- If you choose the Create a virtual hard disk option, you are creating a brand new vhdx disk on your Hyper-V host. You can set the size of the disk as well. The wizard defaults to 127 GB, which can easily be changed.
- The Use an existing virtual hard disk option lets you attach your new VM configuration to an existing virtual disk. Perhaps you copied over a vhdx file that you want to reuse with the new VM configuration. You can simply point the wizard to the vhdx file with this option.
- With the third option – Attach a virtual hard disk later – you can choose to skip the creation of a hard disk in the wizard and assign a disk later.
There is one significant caveat to the create a virtual hard disk option: you have no choice in the type of disk that is created. By default, Hyper-V creates “dynamically expanding” disks, which are thin-provisioned disks. Space is used only as needed. There are some downsides to this approach, however. While the Hyper-V storage driver generally makes efficient use of resources, for the best performance, many may still prefer to provision thick disks or fixed size in Hyper-V. To do that, you should choose the third option and attach a thick virtual hard disk after your VM is created.
Now available: Free Edition of NAKIVO Backup & Replication – absolutely free for your Windows Server 2016 Hyper-V, forever!
The next step is to go through the Installation Options. This means configuring how you want to install the guest operating system (OS) in your new VM.
The most common way is to Install an operating system from a bootable image file. You need to have an ISO file of the OS saved somewhere on your server. Simply guide the Wizard to the location using the Browse button.
Your alternatives are to Install an operating system later or Install an operating system from a network-based installation server.
You’ve now reached the summary of your configuration choices. Once you click Finish, your VM is created according to the options you specified.
Now that configuration and creation are complete, you can power on your VM. Simply right-click the VM and select Start.
You can connect to the console by right-clicking the VM and selecting Connect.
After connecting to the console, we should now be able to boot our VM and install the operating system as usual, through the operating system installation prompts.
We have covered all the configuration options available to you when creating new VMs in the Hyper-V Manager and walked you through the process of VM creation.
This blog post is the sixth in a series on how to use Microsoft’s Windows Server 2016 and Hyper-V for virtualization. We started with the basics, and are progressing towards more advanced topics. Next, we show you how to add a fixed-size (thick-provisioned) hard disk to a VM through the Hyper-V manager. We also discuss copying ISO media to Hyper-V hosts and provisioning VMs using PowerShell.
At NAKIVO, we understand Hyper-V. Our team of experts built NAKIVO Backup & Replication’s functionality while taking all the nuances of Microsoft’s hypervisor into account. This is why you get seamless, efficient, and reliable Hyper-V backup with our solution.
Try for yourself in your own (newly created) Hyper-V environment: download the full-featured free trial.