Welcome!

Virtualization Authors: Liz McMillan, Elizabeth White, Jnan Dash, Lori MacVittie, Michelle Drolet

Related Topics: .NET, Virtualization, Silverlight

.NET: Blog Post

Step-by-Step: Build a Free Hyper-V Server 2012 Cluster - Part 2 of 2

Provision and Test Highly Available VMs on Your Free Private Cloud Foundation!

This article is Part 2 in a two-part series on building a FREE Hyper-V Server 2012 Cluster to support highly available virtual machines as a foundation to a Private Cloud solution. If you missed it, be sure to check out Part 1 of this article series on the initial steps for building Hyper-V Server 2012 hosts in a Failover Cluster configuration.

In this article, we’ll walk through provisioning highly available virtual machines on our new FREE Hyper-V Server 2012 cluster and testing Live Migration failover scenarios.

It’s Time to Build Highly Available VMs!
Now that we have our Hyper-V failover cluster up and running, it’s time to provision our virtual machines in a highly available configuration.  Once provisioned in this manner, highly available virtual machines can failover to other physical nodes within our cluster in both planned and unplanned failover scenarios.

If you’ve installed the Hyper-V Manager and Failover Cluster Manager GUI tools on a Windows Server 2012 management server or Windows 8 admin workstation, you can easily perform these steps remotely using these tools.  See my article on the Remote Server Admin Toolkit for Windows Server 2012 to learn how to setup a Windows 8 admin workstation for remote management of Windows Server 2012 and Hyper-V Server 2012 hosts.

However, in this article, we’ll assume that you’ll be performing these tasks from the console of your Hyper-V Server 2012 hosts using our built-in Hyper-V cmdlets and Failover Clustering cmdlets in PowerShell 3.0.  PowerShell 3.0 ROCKS and is really quite easy to use for these tasks as you’ll see below.

Here are the steps that we’ll be using to build each highly available virtual machine:

  1. Create new Virtual Hard Disks (VHDs or VHDXs) in a shared storage location that is accessible to your clustered configuration. 

    As you may recall from my Part 1 article, we’re using the new SMB 3.0 shared application folder functionality to provide a shared storage location for our highly available VM’s.  To create a new virtual hard disk in this shared location, I’ll use the New-VHD cmdlet in PowerShell 3.0:

    New-VHD -Path \\CAFSC01\HVCVMStorage\HAVM01.VHDX -Dynamic -Size 127GB
  2. Now that we have our Virtual Hard Disk(s) sitting in a shared storage location that is accessible from our clustered hosts, next we’ll use the New-VM cmdlet to provision each new Virtual Machine in the same shared storage location:

    New-VM -Name HAVM01 -Path \\CAFSC01\HVCVMStorage -Memory 1GB -SwitchName "KEMLABNET01" -BootDevice CD -VHDPath \\CAFSC01\HVCVMStorage\HAVM01.VHDX
  3. After each new Virtual Machine is provisioned, we can use additional cmdlets, such as Set-VM, Add-VMDvdDrive and Add-VMHardDiskDrive, to set additional VM settings and/or attach additional virtualized storage devices, as necessary. 

    Since my new Virtual Machine in this example is using a blank Virtual Hard Disk for its storage, I’ll attach an ISO image as a DVD boot device to this VM so that I can install Windows Server 2012 when this VM starts up for the first time:

    Add-VMDvdDrive -VMName HAVM01 -Path \\CAFSC01\ISO\WS2012RTM.ISO
  4. Since the Failover Cluster manages the startup and failover of highly available VMs, we’ll want to disable the Hyper-V Automatic Start Options for each of our VMs in this scenario.  This will prevent Hyper-V from trying to directly manage the startup of these VMs and instead rely on the cluster for startup and failover tasks:

    Set-VM -Name HAVM01 -AutomaticStartAction Nothing
  5. Our VM’s are now setup with the necessary VM configuration settings.  To add our new VMs to the cluster and make them highly available, we’ll now use the Add-ClusterVirtualMachineRole cmdlet as follows:

    Add-ClusterVirtualMachineRole -VirtualMachine HAVM01
  6. Once you’ve setup your new highly available VM’s you can check their status and bring them online with the following cmdlets:

    Get-ClusterGroup

    Start-ClusterGroup –Name “HAVM01”

  7. Your Virtual Machines will start up and you can now connect to their consoles via the VMConnect.exe command-line tool from a remote Windows Server 2012 management server or Windows 8 admin workstation.  VMConnect is included with the Hyper-V Management GUI tools.

    VMConnect.exe <Hyper-V Host> <Virtual_Machine_Name>

    We can use our VMConnect remote console connection to complete the installation and configuration of the Guest OS within each new virtual machine.

We’re finished … Let’s Test!
Our highly available VMs are up and running in our cluster, so let’s test our failover cluster with a Live Migration planned failover using the Move-ClusterVirtualMachineRole cmdlet.  I’ll move one of my highly available VMs to the second physical node in my cluster live while it’s running with the following command line syntax:

Move-ClusterVirtualMachineRole -Name "HAVM01" -Node KEMLABHV07

Now it’s Your Turn! Are you Clustered Yet?
Download our FREE Hyper-V Server 2012 using the link below and step through the commands in Part 1 and Part 2 (this article) of this article series to build your own Hyper-V Cluster with highly available VMs.

Once you’ve finished building your lab, be sure to continue your learning and study on Windows Server 2012 by leveraging our “Early Experts” FREE Online Study Group at …

Feel free to leave your feedback, results and questions in the comments below to share your experiences in building a Hyper-V Cluster!

Hope this helps,

Keith

Build Your Lab! Build Your Lab! Download Windows Server 2012
Build Your Lab in the Cloud! Don’t Have a Lab? Build Your Lab in the Cloud with Windows Azure Virtual Machines
Join our "Early Experts" study group! Want to Get Certified? Join our Windows Server 2012 "Early Experts" Study Group

More Stories By Keith Mayer

Keith Mayer is a Technical Evangelist at Microsoft focused on Windows Infrastructure, Data Center Virtualization, Systems Management and Private Cloud. Keith has over 17 years of experience as a technical leader of complex IT projects, in diverse roles, such as Network Engineer, IT Manager, Technical Instructor and Consultant. He has consulted and trained thousands of IT professionals worldwide on the design and implementation of enterprise technology solutions.

Keith is currently certified on several Microsoft technologies, including System Center, Hyper-V, Windows, Windows Server, SharePoint and Exchange. He also holds other industry certifications from IBM, Cisco, Citrix, HP, CheckPoint, CompTIA and Interwoven.

Keith is the author of the IT Pros ROCK! Blog on Microsoft TechNet, voted as one of the Top 50 "Must Read" IT Blogs.

Keith also manages the Windows Server 2012 "Early Experts" Challenge - a FREE online study group for IT Pros interested in studying and preparing for certification on Windows Server 2012. Join us and become the next "Early Expert"!