Creating Hyper-V Virtual Machines

From Virtuatopia
Jump to: navigation, search
PreviousTable of ContentsNext
Understanding and Configuring Hyper-V Virtual NetworksConfiguring Hyper-V Virtual Machines

Purchase and download the full PDF and ePub versions of this Hyper-V eBook for only $8.99  Add to Cart

The key to virtualization is the ability to create virtual machines. As such, the objective of this chapter is to focus on the steps involved in creating virtual machines using Hyper-V and the Hyper-V Manager.

Launching the Hyper-V Manager

The first step in creating a new virtual machine is to launch the Hyper-V Manager tool. This can either be run directly on the Hyper-V host system, or on a remote system with network access to the host by selecting Start -> Administration Tools -> Hyper-V Manager.

If connecting from a remote system, it will be necessary to connect to the Hyper-V host from within the Hyper-V Manager before creating new virtual machines. This can be achieved by selecting the Action -> Connect to Server... menu option.

To begin the virtual machine creation process, ensure that the correct Hyper-V server is selected from the left hand panel and click on the New link in the Actions panel. From the resulting menu, select Virtual Machine... to invoke the New Virtual Machine Wizard.

Creating a Default Virtual Machine

The New Virtual Machine Wizard will work through a series of steps to define the new virtual machine. If, at any time, the Finish button is pressed, the wizard will create a new virtual machine using default values. This will create a virtual machine with 512MB of memory, one network adapter, one legacy network adapter, a CD drive and a virtual hard disk located in the default location on the host file system.

To configure a virtual machine to a specific specification, click Next to proceed to the Specify Name and Location screen.

Virtual Machine Name and Location

The Specify Name and Location screen provides the opportunity to define a name for the new virtual machine and specify the location where the configuration files will be stored. The location field is populated with the default location, although this may be changed to any location accessible to the host system by selecting the option to Store the virtual machine in a different location:

Configuring the name and location of a new Hyper-V virtual machine

It is important to keep in mind that the location specified here is solely for the configuration files and does not specify the location of any virtual disks which will be assigned to the virtual machine.

Once the information is complete, click Next to proceed to the memory configuration step.

Configuring Virtual Machine Memory

As the name suggests, the Assign Memory screen allows the amount of memory allocated to the virtual machine to be specified. The amount to allocate will depend on a number of factors including:

  • The memory requirements of the guest operating system which will run inside the virtual machine.
  • The amount of physical memory present in the host system.
  • The requirements of other virtual machines which will run concurrently with the virtual machine currently being created.

Note that the amount of memory allocated at this stage may be modified at a later date if the selection made now proves to be problematic. Once the memory allocation has been made, click Next to configure Networking.

Configuring Virtual Machine Networking

Virtual machines are assigned a network adapter which allows the guest operating system to connect to a virtual network. Virtual networks are configured outside of the virtual machine creation process and can be configured using the Virtual Network Manager... link in the Hyper-V Manager Actions panel. Virtual networks can be external (the virtual machine has access to the external network), internal (virtual machine can connect to other virtual machines on the physical host and also with the physical host itself, but not the external network) or private (communication only between virtual machines on the same physical host, no communication with physical host or external network). For an overview of virtual networks refer to the chapter entitled Understanding and Configuring Hyper-V Virtual Networks.

Either select a pre-existing virtual network from the drop down list, or select Not Connected if there is to be no network connection, or the connection is to be configured at a later time. Click Next to proceed to the hard drive configuration screen.

Configuring a Virtual Hard Disk

The guest operating system running in a virtual machine will typically require access to disk storage both to contain the system files and any user data. The first requirement is that the storage to be used by the virtual machine must be accessible to the host system. In terms of storage access, Hyper-V supports Direct Access Storage (DAS) drives including IDE, SATA, SCSI and SAS, and Storage Area Network standards such a fiber channel and iSCSI.

Specifying the Virtual Hard Disk for a Virtual Machine

Assuming that the storage is connected to the host system in some way, there are a number of choices as to how a virtual hard disk is made available to the virtual machine:

  • New Virtual Hard Disk (VHD) - The virtual hard disk is created as a file which resides on a storage volume which is accessible to the host server. Disks can be dynamic expanding (starts small and grows as space is required) or fixed in size. The maximum size of VHD is 2040GB.
  • Existing Virtual Hard Disk (VHD) - A virtual machine can be configured to use a pre-existing disk image file.
  • Passthrough disk - A passthrough disk assigns a physical disk drive to the virtual machine enabling the guest operating system to perform raw read and write actions on the disk. Hyper-V imposes no constraints on the size of a pass-through disk.

To configure a passthrough disk, select the option to Attach a virtual hard disk later.

Having selected the type of disk, and assuming that a pre-existing disk is not being used, select an appropriate disk size and click Next to continue.

Additional information about creating and configuring virtual hard disks can be found in the Creating and Configuring Hyper-V Virtual Hard Disks (VHDs).

Assigning a Passthrough Disk to a Virtual Machine

As previously described, Hyper-V allows a entire physical disk to be allocated to a virtual machine. This configuration is also referred to a passthrough disk. Unfortunately, the Hyper-V virtual machine creation wizard does not provide the option to configure a passthrough disk, leaving this configuration to be performed later. If a passthrough disk is required, select the option to Attach a virtual disk later on the wizard's Connect Virtual Hard Disk screen.

Once the remainder of the virtual machine creation process is completed, right click on the new virtual machine from the Virtual Machines list in the Hyper-V Manager main window and select Settings.... The settings dialog for the selected virtual machine will appear containing a list of devices in the left hand panel. One of these devices will be IDE Controller 0. This was created by default and is intended to have the virtual disk attached to it. If a SCSI controller is required instead, select the Add Hardware option at the top of the device list, select SCSI Controller from the right hand panel and click on the Add button.

In order to add a physical passthrough disk to the virtual machine, select IDE controller 0 (or the SCSI controller if one was added), select Hard Disk from the right hand panel of the dialog and click the Add button as illustrated in the following figure:

Adding a new virtual disk to a hyper-V virtual machine

Once the Add button is pressed, the hard drive settings will appear. As illustrated in the following figure, the hard drive settings screen provides the option to create a Virtual Hard Disk (VHD) file, or to Assign a physical hard disk, the latter being the option we need. At this point it is possible that this configuration option will be disabled. This is most likely because the disk in question is currently online. To take the disk offline, open the Server Manager for the host system and click on Storage -> Disk Management in the left hand panel. In the main panel, right click on the disk name in the graphical section of the view and select Offline from the menu.

Once the disk is offline, the Assign a physical hard disk option will be enabled. Select this option, choose the appropriate disk drive from the drop down list and click Apply to commit the change. The virtual machine has now been assigned a physical disk for its storage purposes.

Virtual Machine Installation Options

Clearly, a virtual machine without a guest operating system is of little use. The next screen in the virtual machine creation process defines how the guest operating system is to be installed. Options provided are to install the operating system later, install from a physical CD or DVD drive, install from a floppy disk drive, install from an ISO image of a CD or DVD or to install from a network based server.

If the option to install from a physical CD/DVD drive is selected, the wizard will provide a list of physical devices attached to the host server. Be sure to select the device which will contain the operating system media.

Completing the Virtual Machine Creation Process

Once installation method has been selected, click Next to proceed to the summary screen. Review the information provided and click Finish to complete the installation process. Once the virtual machine is created, it may be started by double clicking on the corresponding name in the Hyper-V Manager Virtual Machines list. Once the Virtual Machine Connection dialog appears, click on the Start button to power on the machine.

Purchase and download the full PDF and ePub versions of this Hyper-V eBook for only $8.99  Add to Cart