Defining Basic Virtual Machine Configuration Parameters
Before you create a new virtual machine (VM) using the Hyper-V Manager, it is crucial that you define these essential parameters:
Virtual Machine Name
This is the name that is associated by default with the new virtual machine folder, as well as the new virtual hard disk (VHD) that will contain the virtual machine operating system and data files. This is also the virtual machine name that is displayed in the Hyper-V Manager console. You should develop a naming convention that reflects the information that is required in your environment to quickly and appropriately identify the new VM.
Virtual Machine Processor Allocation
This represents the number of virtual processors to allocate to the new virtual machine. This parameter should take into consideration the requirements of the virtual machine guest operating system and hosted applications, as well as those of other running virtual machines, and the host operating system. All of the Microsoft Windows Server 2008 Hyper-V editions and Microsoft Hyper-V Server 2008 support a maximum of 24 logical processors in a Hyper-V host (up to 4 physical processors, each with 6 cores), and a maximum virtual machine allocation of 4 virtual processors. Although this is not used in the New Virtual Machine Wizard, you must define this parameter to ensure that you create the new virtual machine on a Hyper-V host with sufficient resources to support it.
Virtual Machine Memory Allocation
This represents the amount of memory to allocate to the new virtual machine. The memory allocation should take into consideration the amount of RAM in the physical server in conjunction with the memory requirements of the new guest operating system and hosted applications, as well as other running virtual machines. Microsoft Hyper-V Server 2008 and Windows Server 2008 Standard Edition limit a virtual machine memory allocation to 31 GB, while Microsoft Windows Server 2008 Enterprise and Datacenter Edition allow a maximum memory allocation of 64 GB.
Virtual Hard Disk Size and Location
If you need to install a new guest operating system, you must define the size for a new IDE-based virtual hard disk. In Hyper-V, IDE-based VHDs can support up to 2040 GB. Although Hyper-V also includes a SCSI controller, it is a synthetic device (one that does not represent a physical counterpart) that cannot be used to boot a VHD without an installed operating system. Unless you specify otherwise, a new virtual hard disk is stored in the default virtual machine directory using the same name as the virtual machine and a .vhd extension. If you intend to connect a pre-existing VHD to the new virtual machine, you must define the virtual hard disk folder location and copy the VHD to it prior to creating the VM.
Virtual Network Connection
This represents the virtual network to connect to the new virtual machine. If you want to isolate the virtual machine, you can choose not to connect the virtual network adapter to any virtual network. Hyper-V allows connection multiple virtual networks using a combination of legacy and synthetic virtual network adapters. However, the New Virtual Machine Wizard only provides the connection to a single virtual network.
Installation Method and Media
There are several methods available in Hyper-V to install a guest operating system in a new virtual machine. You can use physical installation media in a connected CD/DVD-ROM drive mapped to a virtual CD/DVD-ROM drive, an accessible ISO image file that contains a bootable image of a guest operating system, a virtual floppy boot disk image, or a network-based installation.
Once you have defined these basic parameters, you are ready to create a virtual machine using the New Virtual Machine Wizard available in Hyper-V Manager.
Starting the Hyper-V Manager
The Hyper-V Manager MMC is installed when the Hyper-V role is configured in a full installation of Microsoft Windows Server 2008. It is the default graphical user interface that allows you to manage and configure Hyper-V hosts and virtual machines. Through the Start menu, you can select the Hyper-V Manager from the Administrative Tools menu as shown in Figure 1. In a default installation, you can also invoke it using the Start menu Run option or from a command prompt by typing in c:\Program Files\Hyper-V\virtmgmt.msc.
Figure 1: Hyper-V Manager Administrative Tools Menu Option
As shown in Figure 2, the Hyper-V Manager console is divided into three sections. The left pane displays the tree view of managed Hyper-V hosts. The center pane displays existing virtual machines and their state, as well as a tree view of existing snapshots and a minimized view of the virtual machine console when a virtual machine is selected. The right pane contains the list of actions available to manage the Hyper-V hosts and virtual machines. The list of virtual machine actions is only displayed after a virtual machine is created or added on the Hyper-V host.
Figure 2: Hyper-V Manager Console
Creating a Virtual Machine Using the New Virtual Machine Wizard
The first step to create a new virtual machine is to select the New | Virtual Machine option from the Actions pane, as shown in Figure 3. As a result, the New Virtual Machine Wizard is invoked and you can begin to enter the basic virtual machine configuration information.
Figure 3: Invoking the New Virtual Machine Wizard in Hyper-V Manager
Figure 4 shows the Before You Begin dialog of the New Virtual Machine Wizard. This is the starting point from which you can create a new virtual machine.
Figure 4: New Virtual Machine Wizard in Hyper-V Manager
To continue the process, click Next in the Before you Begin dialog.
In the Specify Name and Location dialog, shown in Figure 5, enter the new virtual machine name in the Name text box. Unless you specify otherwise, the virtual machine will be stored in the default configuration folder that appears in the Location text box.
If you want to define a new location for the virtual machine folder, select the Store The Virtual Machine In A Different Location check box, then type in a fully qualified path (for example, D:\Hyper-V VMs\Win2008). If the folder does not exist, it will be created. It is worthwhile to take notice, as indicated in the dialog, that you must select a storage location with sufficient free space if you plan on creating one or more snapshots for the virtual machine.
Figure 5: Specify Name and Location Dialog
Once you have entered the information and click Next, the Assign Memory dialog, shown in Figure 6, is displayed.
Figure 6: Assign Memory Dialog
In the Memory text box, enter the memory allocation for the new virtual machine. The default value of 512 MB reflects a minimum allocation that you should replace with a value based on the factors mentioned in the Defining Basic Virtual Machine Configuration Parameters section of this article.
Once you click Next, the Configure Networking dialog, shown in Figure 7, allows you to choose a preconfigured virtual network to connect to the new virtual machine. Use the Connection pull-down menu to choose the appropriate virtual network. If you plan to install an operating system that requires updates, you might want to choose the Not Connected option or connect the virtual machine to a private network to ensure that the new virtual machine remains isolated until it is fully updated.
Figure 7: Configure Networking Dialog
After clicking Next, the following step is to configure a VHD to connect to the virtual machine, as shown in the Connect Virtual Hard Disk dialog in Figure 8.
Figure 8: Connect Virtual Hard Disk Dialog
When you select Create a Virtual Hard Disk, you are choosing to create a new dynamically expanding virtual hard disk to connect to the virtual machine. You can either choose to store the new VHD in the default folder displayed in the Location text box, or you can select a different folder. In the Size text box, you must type in the desired maximum size of the VHD. Because the default new virtual hard disk type is dynamically expanding, the file contains only basic header information until an operating system is installed. Hyper-V allocates file space to the virtual hard disk as required, up to the defined maximum size.
If you pre-created a virtual hard disk to connect to the new virtual machine, select Use An Existing Virtual Hard Disk. You can then click the Browse button to navigate to the folder location and select the virtual hard disk file to populate the Location text box. Alternatively, you can also simply type in the fully qualified path and file name.
If you do not want to connect a virtual hard disk to the virtual machine, select the Attach A Virtual Hard Disk Later option. If this is the case, you will not be able to start the virtual machine immediately after it is created.
When you click Next, the Installation Options dialog, shown in Figure 9, allows you to choose if and how the guest operating system will be installed in the new virtual machine.
Figure 9: Installation Options Dialog
If you want to create the virtual machine, but not start the operating system installation, select the Install An Operating System Later option.
In this example, an ISO image of the Microsoft Windows Server 2008 operating system is used. Therefore, the Install An Operating System From A Boot CD/DVD-ROM option is selected, and the Image File (.iso) text box reflects the location of the ISO file. Another option is to select the Physical CD/DVD Drive option to connect physical media to the new virtual machine. The physical media will be available through the virtual CD/DVD ROM that is automatically configured in the new virtual machine.
If you need to install the guest operating system from a floppy disk image, select the Install an Operating System From a Boot Floppy Disk.
If you select Install an Operating System From A Network-Based Installation Server, you must ensure that the virtual machine is also connected to a virtual network that provides a communication path to the installation server.
Finally, clicking Next brings you to the Completing the New Virtual Machine Wizard dialog shown in Figure 10.
Figure 10: Completing the New Virtual Machine Dialog
At this juncture, you can review the selected options and information that you entered before creating the virtual machine. By default, the virtual machine will not be started after Hyper-V creates it. However, you can select the StartThe Virtual Machine After It Is Created option, if you do want to start execution immediately after virtual machine creation.
Once you click Finish, Hyper-V will begin the process to create the virtual machine and display an indicator bar like that shown in Figure 11 that provides status. When the process completes, you are ready to return to the Hyper-V Manager and modify any settings before you start the virtual machine and begin the operating system installation.
Figure 11: Example of the Virtual Machine Process Indicator Bar
Using the New Virtual Machine Wizard, you can see how easy it is to create a new virtual machine in Hyper-V. However, you must ensure that you have appropriately planned the new virtual machine settings, especially those related to virtual machine nomenclature, resource allocation, and file storage location.