Hyper-V Failover Cluster Setup and High Availability Configuration

For the virtual machines that run on 2 physical hosts to continue running on the other host without manual intervention when 1 of the hosts fails, the Hyper-V role must be installed together with the Failover Clustering feature. A failover cluster is a structure in which the nodes monitor each other and share a common storage area, and in which the other node takes over the roles of a node that cannot be reached. Because the disk files of the virtual machine are on the shared storage, the node that takes over runs the virtual machine by using the same files.

The installation itself appears to consist of a few wizard pages, but whether the structure behaves as expected depends on the components behind these pages. The main ones are Active Directory membership and DNS records, the separation of network traffic, the correct presentation of the shared disks to both nodes, and the quorum configuration. When 1 of these components is missing, the cluster is created, but the virtual machine does not start on the other node at the first failover.

In this article, a 2-node Hyper-V failover cluster is built in a lab environment from start to finish. The lab environment and the pre-checks are given first. The role and feature installation, the virtual switch, the shared disks on the iSCSI target, the validation and creation of the cluster, the creation of a highly available virtual machine and, finally, the failover test are then explained. The installation of the Active Directory domain and joining the servers to the domain are outside the scope of this article.

The steps and screenshots in this article belong to a Windows Server 2012 R2 lab environment. Extended support for Windows Server 2012 R2 ended on 10 October 2023. New installations must use a supported Windows Server version.

1- Lab Environment and Pre-Check List

Before the installation and configuration, the structure that is used in this scenario is introduced. The environment has 1 domain controller and the 2 nodes that form the cluster.

⚡SRVDC001

It is the domain controller of the firatboyan.com domain. Because the environment has no separate storage device, the iSCSI Target Server role is also installed on this server, and the Quorum and ClusterVolume disks that the cluster uses are created on this server.

➥ Domain: SRVDC001.firatboyan.com
➥ Role: Domain controller, storage (because the environment has no storage device)
➥ Services to Install: Active Directory Domain Services (AD DS), DNS, iSCSI Target
➥ Network:

Network Adapter 1- LAN: 10.10.10.200 /24
Network Adapter 2- iSCSI: 10.10.11.200 /24
Network Adapter 3- VM: 10.10.10.150 /24

Using the domain controller as the storage at the same time is valid only for a lab environment. When this server shuts down, the cluster loses both the domain controller and its shared disks at the same time.

⚡SRVNODE1

In this scenario, the virtual machines are created on this node from Failover Cluster Manager.

➥ Domain: SRVNODE1.firatboyan.com
➥ Role: Domain member
➥ Services to Install: Hyper-V, Failover Clustering, Multipath I/O
➥ Network:

Network Adapter 1- LAN: 10.10.10.201 /24
Network Adapter 2- iSCSI: 10.10.11.201 /24
Network Adapter 3- VM: 10.10.10.151 /24

⚡SRVNODE2

In this scenario, this is the node that takes over the virtual machines at the time of a failover. No virtual machine is created on this node. Only the same role, features and configuration are applied.

➥ Domain: SRVNODE2.firatboyan.com
➥ Role: Domain member
➥ Services to Install: Hyper-V, Failover Clustering, Multipath I/O
➥ Network:

Network Adapter 1- LAN: 10.10.10.202 /24
Network Adapter 2- iSCSI: 10.10.11.202 /24
Network Adapter 3- VM: 10.10.10.152 /24

The VM network allows the virtual machines that are created on the hosts to communicate with the other physical and virtual systems. The physical network adapter that the external virtual switch is bound to is connected to the LAN, so the virtual machines can communicate with all systems on the 10.10.10.0/24 network.

The structure to be built is roughly as shown below. The virtual machines run on SRVNODE1, and SRVNODE2 takes them over automatically when SRVNODE1 fails.

hyper-v failovercluster

Network Interface Card (NIC) Configuration

In a failover cluster, each network adapter is separated according to the type of traffic that it carries. When management and intra-cluster communication (heartbeat), storage traffic and virtual machine traffic pass through the same adapter, heavy disk traffic can delay the heartbeat packets and the nodes can mark each other as unreachable. In this lab, 3 adapters are used on each server.

Network Subnet Traffic Carried
LAN 10.10.10.0/24 Management, domain and DNS access, intra-cluster communication
iSCSI 10.10.11.0/24 Storage traffic between the nodes and the iSCSI target
VM 10.10.10.0/24 Virtual machine traffic through the external virtual switch

The default gateway is entered only on the LAN adapter. No gateway or DNS address is entered on the iSCSI adapter, because this network carries storage traffic only inside its own subnet. When a gateway is entered on more than 1 adapter, the server has more than 1 default route and traffic can leave from an unexpected adapter.

A separate note is needed for the VM adapter. When this adapter is bound to the external virtual switch and is not shared with the host, the host does not use the IP configuration on it. The virtual machines get their own IP addresses from the 10.10.10.0/24 network.

After the configuration is finished, the final state of the adapters is checked with the ipconfig /all and route print commands. An address that was obtained from DHCP or a gateway that was entered on the wrong adapter is immediately visible in these outputs.

ipconfig

Pre-Check List

Before the installation starts, the items below are verified.

Check Expected State
Domain membership SRVNODE1 and SRVNODE2 are members of the firatboyan.com domain
Operating system Both nodes run the same Windows Server version
Permissions The account that performs the installation is a local Administrator on both nodes and can create computer objects in Active Directory
DNS The nodes use SRVDC001 as the DNS server and resolve each other's names
LAN network The 3 servers reach each other on the 10.10.10.0/24 network
iSCSI network The 3 servers reach each other on the 10.10.11.0/24 network, and no gateway is defined on these adapters
Cluster name and IP address The name and the LAN IP address that are reserved for the cluster are not used by another device

2- Decision Table

The decisions that are made on the wizard pages during the installation are collected below. In this way, the choices are made clear at the planning stage, not on the installation page.

Step Page Decision to Make Choice in This Installation
Step 4 - Selecting the Failover Clustering and Multipath I/O Features Select features Which features are installed together with Hyper-V Failover Clustering and Multipath I/O
Step 5 - Hyper-V Information Page and Create Virtual Switches Create Virtual Switches Whether the virtual switch is created during the installation or afterwards No adapter selected, the switch was created in Step 11 - Creating an External Virtual Switch
Step 6 - Virtual Machine Migration Virtual Machine Migration Whether live migration is enabled on this page No selection made
Step 7 - Default Stores Default Stores Default virtual machine and disk folders Left as default, the location was given as the shared disk when the virtual machine was created
Step 12 - Defining the Virtual Switch Properties Virtual Switch Properties Switch type and name External, the same name on both nodes: FailoverVirtualSwitch
Step 15 - Quorum Virtual Disk: Location, Name and Size Specify iSCSI virtual disk size Size of the Quorum disk 1 GB
Step 16 - Quorum Target and Access Servers Add initiator ID Which value identifies the nodes IP Address
Step 17 - Authentication, Confirmation and Result Enable Authentication Whether CHAP is used Not configured
Step 18 - ClusterVolume Virtual Disk: Location, Name and Size Specify iSCSI virtual disk size Size of the ClusterVolume disk 30 GB
Step 29 - Validation Warning Validation Warning and Testing Options Whether the validation tests are run Yes, then Run all tests
Step 31 - Access Point for Administering the Cluster Access Point for Administering the Cluster Cluster name and IP address A name and an IP address that are not in use on the network
Step 35 - Specify Name and Location Specify Name and Location Name of the virtual machine and location of its files ClusterVM01, the FiloverClusterVMs folder on the shared disk
Step 38 - Configure Networking Configure Networking Virtual switch that the virtual machine connects to FailoverVirtualSwitch
Step 39 - Connect Virtual Hard Disk Connect Virtual Hard Disk How the virtual disk is provided and its location Create a virtual hard disk, ClusterVM01.vhdx, the FiloverClusterDisks folder on the shared disk
Step 40 - Installation Options Installation Options Installation source of the operating system Image file (.iso) in the ISO folder on the shared disk

3- Hyper-V, Failover Clustering and Multipath I/O Installation

The Hyper-V role provides the virtualisation layer. The Failover Clustering feature provides the communication between the nodes, the quorum configuration and the management of shared resources. Multipath I/O provides access to the same disk over more than 1 path. All 3 are installed in a single run of the wizard. The installation can also be done with PowerShell instead of the GUI, but in this article Server Manager is used. The steps are applied on SRVNODE1 first.

Step 1 - Starting the Add Roles and Features Wizard

In the Server Manager console, the wizard is opened by clicking Add Roles and Features under the Manage menu.

Windows Server 2012 Hyper-V Failover Cluster installation

In the first window that opens, Next is clicked to continue.

Windows Server 2012 Hyper-V Failover Cluster installation

Step 2 - Installation Type and Destination Server

On the Select installation type page, Role-based or feature-based installation is selected. This is the option used for standard role and feature installations.

Windows Server 2012 Hyper-V Failover Cluster installation

On the Select destination server page, the server on which the installation is performed is selected. Because the installation is performed on SRVNODE1, this server is selected.

Windows Server 2012 Hyper-V Failover Cluster installation

Step 3 - Selecting the Hyper-V Role

On the Select server roles page, the Hyper-V role is selected.

Windows Server 2012 Hyper-V Failover Cluster installation

When the role is selected, a window opens and states that the Hyper-V Module for Windows PowerShell and Hyper-V GUI Management Tools under Remote Server Administration Tools are also installed. Add Features is clicked.

Windows Server 2012 Hyper-V Failover Cluster installation

The Hyper-V role is now selected for installation. Next is clicked to continue.

Windows Server 2012 Hyper-V Failover Cluster installation

Step 4 - Selecting the Failover Clustering and Multipath I/O Features

When the Hyper-V role is installed alone, the virtual machines run only on the host where they are created. For the virtual machine to be taken over by another node, the Failover Clustering feature is also selected on the Select features page.

When a LUN that is presented over iSCSI or an HBA is reached over more than 1 path, Multipath I/O manages these paths as a single disk and continues the access over the other path when 1 of the paths fails. In this lab, each node has a single iSCSI path to the target, so Multipath I/O is not actually used. The feature is added to reflect the installation in enterprise environments where the storage is connected over more than 1 path. For the feature to work on iSCSI disks, iSCSI support must be added in the MPIO properties after the installation and a second path to the target must be defined.

Windows Server 2012 Hyper-V Failover Cluster installation

When Failover Clustering is selected, a window opens and states that the Failover Clustering Tools under Remote Server Administration Tools (Failover Cluster Management Tools and Failover Cluster Module for Windows PowerShell) are also installed. Add Features is clicked so that these tools are installed.

Windows Server 2012 Hyper-V Failover Cluster installation

Windows Server 2012 Hyper-V Failover Cluster installation

Windows Server 2012 Hyper-V Failover Cluster installation

Step 5 - Hyper-V Information Page and Create Virtual Switches

After the summary information page about the Hyper-V role is reviewed, Next is clicked.

Windows Server 2012 Hyper-V Failover Cluster installation

The Create Virtual Switches page asks which physical adapter the virtual machines use to reach the network. When an adapter is selected here, the wizard creates an external virtual switch that is bound to that adapter. On this page, no Network Adapter is selected and Next is clicked to continue, because the switch is created after the installation from Hyper-V Manager, with the same name on both nodes.

Windows Server 2012 Hyper-V Failover Cluster installation

Step 6 - Virtual Machine Migration

On the Virtual Machine Migration page, the selections are whether this host is allowed to send and receive live migrations and which authentication protocol is used. This setting is used for migrations between hosts that are not part of a cluster. On a host that joins a cluster, the live migration settings are managed through the cluster, so no selection is made on this page.

Windows Server 2012 Hyper-V Failover Cluster installation

Step 7 - Default Stores

The Default Stores page defines the folders where the virtual disk files and the virtual machine configuration files are written by default. The default folders are on the system disk and can be reached only by that host.

The files of a virtual machine that runs in a failover cluster must be on the shared disk that both nodes can reach. For this reason, the default folders are not changed. The location is given when the virtual machine is created, by pointing to the shared disk.

Windows Server 2012 Hyper-V Failover Cluster installation

Step 8 - Confirming and Completing the Installation

On the Confirm installation selections page, the installation is started by clicking Install. Restart the destination server automatically if required is selected so that the server restarts automatically at the end of the installation.

The Hyper-V role requires a restart of the server. The installation causes an interruption if another service is running on the server.

Windows Server 2012 Hyper-V Failover Cluster installation

The Installation progress page shows that the installation of the Hyper-V role and the Failover Clustering and Multipath I/O features has started.

Windows Server 2012 Hyper-V Failover Cluster installation

Windows Server 2012 Hyper-V Failover Cluster installation

Windows Server 2012 Hyper-V Failover Cluster installation

Verification Point
After the server restarts, the Hyper-V role and the Failover Clustering and Multipath I/O features appear as installed.

Step 9 - Repeating the Same Installation on SRVNODE2

The Hyper-V, Failover Clustering and Multipath I/O installation that was performed on SRVNODE1 is also performed on SRVNODE2. Because the steps are exactly the same, the screenshots are not repeated. It is enough to apply Step 1 to Step 8 on SRVNODE2 with the same selections.

4- Virtual Switch Configuration

The virtual switch determines how the virtual machine connects to the network. Hyper-V offers 3 switch types. The types are explained in detail in the article on virtual switch types in Hyper-V, so only the differences are summarised here.

Switch Type Physical NIC Connection Who Communicates
External Yes Virtual machines, the host and the physical network
Internal No Virtual machines and the host
Private No Only the virtual machines on the same host

Because the virtual machines must communicate with the physical network, an external virtual switch is created. The operation is performed on SRVNODE1 first.

Step 10 - Opening Virtual Switch Manager

In Hyper-V Manager, with SRVNODE1 selected, Virtual Switch Manager... is clicked in the Actions pane.

Virtual Switch

Step 11 - Creating an External Virtual Switch

In the Virtual Switch Manager for SRVNODE1 window, with External selected, Create Virtual Switch is clicked.

Virtual Switch

Step 12 - Defining the Virtual Switch Properties

The settings of the switch are configured under Virtual Switch Properties.

A name for the switch is entered in the Name box. The name that is used in this structure is FailoverVirtualSwitch. In a failover cluster, the virtual switch that the virtual machine uses must exist with the same name on both nodes. If the destination node has no switch with the same name, live migration fails. In Hyper-V Replica, the same name is not mandatory, because the network adapter of the replica virtual machine is connected separately to a switch on the replica host.

In the Connection type area, with External network selected, the adapter that the virtual machines use to reach the physical network is selected. In this lab, the selected adapter is the VM adapter, which is connected to the LAN.

If the environment has a VLAN structure defined on the switch, and the management traffic of the host through this switch must belong to a specific VLAN, the VLAN ID box is selected and the number is entered. Because this environment has no VLAN, this field is left empty.

If the number of network adapters is limited, the same adapter can also be used for the management of the host. To do this, the Allow management operating system to share this network adapter box is selected, and a vEthernet adapter that can be assigned an IP address is created under Network Connections. In enterprise environments, sharing the virtual machine adapter with management is not recommended.
While the external virtual switch is created, the connection of the selected physical adapter is interrupted for a short time. A remote session that is connected to the server through this adapter is disconnected.

After the settings are completed, the switch is created by clicking Apply.

Virtual Switch

Step 13 - Creating the Same Virtual Switch on SRVNODE2

Step 10 to Step 12 are repeated on SRVNODE2 with the same switch name. Because the steps are exactly the same, the screenshots for SRVNODE2 are not published.

5- iSCSI Target Server Installation and Virtual Disks

A failover cluster needs shared disks that both nodes can see. In enterprise environments, these disks are presented from a storage system connected through an HBA or from a storage device that supports iSCSI. Because this environment has no storage device, the shared disks are created on SRVDC001 with the iSCSI Target Server role of Windows Server.

iSCSI (Internet Small Computer System Interface) carries SCSI commands over TCP/IP so that a remote disk appears on the server as a local disk. It has 2 components. The target is the side that presents the disk to the network. The initiator is the server that connects to this disk. In this structure, the target is SRVDC001 and the initiators are SRVNODE1 and SRVNODE2. Each disk that is presented by iSCSI Target Server is a virtual disk file on the server.

2 disks are created. Quorum is the disk that the cluster uses as the disk witness. ClusterVolume is the disk where the files of the virtual machines are kept.

Step 14 - Installing the iSCSI Target Server Role

On SRVDC001, Server Manager is opened and the iSCSI tab under File and Storage Services is selected.

Windows Server 2012 Hyper-V Failover Cluster installation

The installation is started by clicking the To install iSCSI Target Server, start the Add Roles and Features Wizard link on this tab. On the Select features page, iSCSI Target Server needs no additional feature, so Next is clicked without a selection.

Windows Server 2012 Hyper-V Failover Cluster installation

On the Confirm installation selections page, Install is clicked.

Windows Server 2012 Hyper-V Failover Cluster installation

The Installation progress page shows that the role is installed.

Windows Server 2012 Hyper-V Failover Cluster installation

Windows Server 2012 Hyper-V Failover Cluster installation

Step 15 - Quorum Virtual Disk: Location, Name and Size

After the role is installed, the To create an iSCSI virtual disk, start the New iSCSI Virtual Disk Wizard link on the iSCSI tab is clicked.

Windows Server 2012 Hyper-V Failover Cluster installation

On the Select iSCSI virtual disk location page, the Server section shows the server on which iSCSI Target Server was installed, and the Select by volume section shows the volumes on this server. By default, the disk file is created in the iSCSIVirtualDisks folder on the selected volume. If a different folder is required, it is specified with Type a custom path. The default setting is not changed.

Windows Server 2012 Hyper-V Failover Cluster installation

On the Specify iSCSI virtual disk name page, the disk is named Quorum. The Path line shows the directory where the disk file is created.

Windows Server 2012 Hyper-V Failover Cluster installation

On the Specify iSCSI virtual disk size page, the size can be entered in MB, GB or TB. For the Quorum disk, 1 GB is entered.

The disk witness holds a copy of the cluster configuration database and has 1 vote in the quorum calculation. It holds no application data or virtual machine files. For this reason, a small disk is enough. The lower limit is 512 MB. 1 GB is a commonly used value that is above this limit. Defining a larger disk gives no additional benefit.

This disk is used only as a witness. No other data is placed on it and it is not converted to a Cluster Shared Volume, because a disk that has been added to CSV cannot be used as a disk witness.

Windows Server 2012 Hyper-V Failover Cluster installation

Step 16 - Quorum Target and Access Servers

On the Assign iSCSI target page, the target through which the disk is presented is selected. If a target was created on the server earlier, it is listed under Existing iSCSI target. Because a new target is created, New iSCSI target is selected.

Windows Server 2012 Hyper-V Failover Cluster installation

On the Specify target name page, a name is entered for the Quorum target.

Windows Server 2012 Hyper-V Failover Cluster installation

The Specify access servers page defines which servers can connect to this target. An initiator that is not in the list cannot see the target. To add a server, Add is clicked.

Windows Server 2012 Hyper-V Failover Cluster installation

On the Add initiator ID page, in the Enter a value for the selected type section, the initiator can be identified with 1 of the IQN, DNS Name, IP Address or MAC Address values. IP Address is selected here. The address entered here must be the address of the node on the network that it uses to connect to the target. In this lab, the network that is reserved for iSCSI traffic is the 10.10.11.0/24 network.

Windows Server 2012 Hyper-V Failover Cluster installation

Windows Server 2012 Hyper-V Failover Cluster installation

Windows Server 2012 Hyper-V Failover Cluster installation

The second node (SRVNODE2) is added in the same way.

Windows Server 2012 Hyper-V Failover Cluster installation

Windows Server 2012 Hyper-V Failover Cluster installation

Step 17 - Authentication, Confirmation and Result

On the Enable Authentication page, authentication with CHAP can be defined optionally. In the lab environment, Next is clicked without any configuration.

Windows Server 2012 Hyper-V Failover Cluster installation

The Confirmation page shows the Quorum disk that is created, the target, the IP addresses of the servers that are given access, and the authentication information. Create is clicked.

Windows Server 2012 Hyper-V Failover Cluster installation

The configuration completes successfully.

Windows Server 2012 Hyper-V Failover Cluster installation

Back in Server Manager, the iSCSI virtual disk that was named Quorum appears in the list.

Windows Server 2012 Hyper-V Failover Cluster installation

Step 18 - ClusterVolume Virtual Disk: Location, Name and Size

The disk where the files of the virtual machines are kept is created next. In the iSCSI section, New iSCSI Virtual Disk is selected from the right-click menu.

Windows Server 2012 Hyper-V Failover Cluster installation

On the Select iSCSI virtual disk location page, Next is clicked without changing the default setting.

Windows Server 2012 Hyper-V Failover Cluster installation

On the Specify iSCSI virtual disk name page, the disk is named ClusterVolume. The Path line shows the directory where the disk file is created.

Windows Server 2012 Hyper-V Failover Cluster installation

On the Specify iSCSI virtual disk size page, the size and type of the disk are defined. The 3 disk types on this page are as follows.

Disk Type Space Usage Performance Suitable Scenario
Fixed size The full defined size is allocated at creation time The most predictable type, no expansion takes place during operation Production systems that generate high I/O
Dynamically expanding Uses very little space at the start and grows as data is written A delay can occur during expansion Lab environments and systems that generate low I/O
Differencing Only the blocks that differ from the parent disk are kept Depends on the parent disk Temporary test structures where changes need to be reverted

On a fixed size disk, the space is allocated in advance. If the Clear the virtual disk on allocation option is selected, the disk is filled with zeros while it is created. In this way, remnants of data that was previously in the same physical area cannot be read through the new disk. This operation increases the creation time on large disks.

On a dynamically expanding disk, the fill level of the volume must be monitored. Because the defined size of the disk and the space that it physically uses are different, the underlying volume can become full as the disk grows, and the servers that use the disk then receive write errors.

A differencing disk is not suitable for a production environment. When the parent disk is corrupted or cannot be reached, all differencing disks that depend on it also become unusable.

30 GB is entered as the size of the ClusterVolume disk and Next is clicked.

Windows Server 2012 Hyper-V Failover Cluster installation

Step 19 - ClusterVolume Target and Access Servers

On the Assign iSCSI target page, the target that was created in Step 16 is now listed under Existing iSCSI target. Because a separate target is required for ClusterVolume, New iSCSI target is selected.

Windows Server 2012 Hyper-V Failover Cluster installation

On the Specify target name page, a name is entered for the ClusterVolume target.

Windows Server 2012 Hyper-V Failover Cluster installation

On the Specify access servers page, Add is clicked.

Windows Server 2012 Hyper-V Failover Cluster installation

On the Add initiator ID page, SRVNODE1 is added, again with the IP Address value.

hyper-v failovercluster

hyper-v failovercluster

The second node (SRVNODE2) is added in the same way.

hyper-v failovercluster

 hyper-v failovercluster

Step 20 - Authentication, Confirmation and Result

On the Enable Authentication page, Next is clicked without any configuration.

Windows Server 2012 Hyper-V Failover Cluster installation

On the Confirmation page, the ClusterVolume disk that is created, the target and the IP addresses of the servers that are given access are checked, and then Create is clicked.

Windows Server 2012 Hyper-V Failover Cluster installation

The View results page shows that the configuration has started.

Windows Server 2012 Hyper-V Failover Cluster installation

The configuration completed successfully. The wizard is closed by clicking Close.

Windows Server 2012 Hyper-V Failover Cluster installation

Windows Server 2012 Hyper-V Failover Cluster installation

Verification Point
The iSCSI tab in Server Manager lists 2 iSCSI virtual disks named Quorum and ClusterVolume. Because no initiator has connected yet, the targets are not in the connected state.

6- iSCSI Initiator Connection

The disks that were created on SRVDC001 are now connected to the nodes. iSCSI Initiator is a built-in component that comes with Windows Server. When it is run for the first time, it asks for confirmation to start its service. After the connection is established, the disks on the target appear as local disks in the Disk Management console of the node.

Step 21 - Connecting to the Target on SRVNODE1

On SRVNODE1, iSCSI Initiator is run. In the iSCSI Initiator Properties window, the IP address of SRVDC001 is entered in the Target box and Quick Connect is clicked. For the storage traffic to flow over the reserved network, the address of SRVDC001 on the iSCSI network (10.10.11.200) must be used here.

Windows Server 2012 Hyper-V Failover Cluster installation

The Quick Connect window shows the Quorum and ClusterVolume targets that were created on the iSCSI Target Server.

Windows Server 2012 Hyper-V Failover Cluster installation

Each of the 2 targets is selected in turn and Connect is clicked. A connection that is established with Quick Connect is added to the Favorite Targets list, so the connection is re-established automatically when the server restarts.

Windows Server 2012 Hyper-V Failover Cluster installation

Windows Server 2012 Hyper-V Failover Cluster installation

After the connections are established, the window is closed by clicking Done. The iSCSI Initiator Properties page shows that both targets are connected.

Windows Server 2012 Hyper-V Failover Cluster installation

Step 22 - Connecting to the Target on SRVNODE2

The operation in Step 21 is applied on SRVNODE2 in the same way. Because the steps are exactly the same, they are not repeated.

Step 23 - Checking the Connection Status from SRVDC001

The connection of the nodes to the targets is checked on SRVDC001, under Server Manager > File and Storage Services > iSCSI.

virtual disks

virtual disk

Verification Point
The status of the targets that belong to the Quorum and ClusterVolume disks appears as Connected.

7- Preparing the Disks

After the iSCSI connection is established, the nodes recognise the disks as physical disks, but the disks are in the Offline and Unknown state. For the disks to be added to the cluster, they must be brought online and initialised, and a volume formatted with NTFS must be created on each of them. The disk that is used as the disk witness must also contain a formatted volume.

The partition style is selected during initialisation. The difference between the 2 options is as follows.

Property GPT (GUID Partition Table) MBR (Master Boot Record)
Number of partitions Up to 128 in Windows A maximum of 4 primary partitions
Disk size limit No 2 TB limit Space above 2 TB cannot be used
Backup of the partition table A backup copy is kept at the end of the disk No backup copy
When it is preferred Large-capacity disks and current structures Disks below 2 TB and compatibility with older systems

Whether the server starts with BIOS or UEFI concerns only the boot disk from which the operating system is loaded. On data disks such as the ones here, both partition styles can be used. Because the disks in this lab are 1 GB and 30 GB, both options work without problems.

Step 24 - Bringing the Disks Online

On SRVNODE1, the Disk Management section of the Computer Management console is opened. Both disks appear in the Offline and Unknown state.

Windows Server 2012 Hyper-V Failover Cluster installation

The ClusterVolume and Quorum disks are brought to the Online state from the right-click menu.

Windows Server 2012 Hyper-V Failover Cluster installation

hyper-v failovercluster

Step 25 - Initialising the Disks

Both disks are initialised with the Initialize Disk option.

Windows Server 2012 Hyper-V Failover Cluster installation

Step 26 - Creating a Simple Volume

Disk 1 is right-clicked and New Simple Volume... is selected.

hyper-v failovercluster

The new volume is named ClusterVolume.

hyper-v failovercluster

Disk 2 is then right-clicked and New Simple Volume... is selected again.

hyper-v failovercluster

This volume is named Quorum.

hyper-v failovercluster

hyper-v failovercluster

Step 27 - Checking the Disks on SRVNODE2

The initialisation and the volume creation are performed on 1 node only. Because the partition table and the file system are written to the disk itself, the other node sees the same structure as ready. For this reason, Disk Management is opened on SRVNODE2 only to verify that both disks are visible, and the disks are left offline. After the cluster is created, the Cluster service manages the ownership of the disks.

Until the cluster is created, the same NTFS volume must not be brought online on 2 nodes at the same time. NTFS does not support simultaneous writes to the same volume from 2 servers, and this situation can cause data corruption.

8- Cluster Validation and Creation

Before the cluster is created, validation tests check whether the nodes are suitable to work together in terms of network, storage, system configuration and Active Directory. Microsoft requires a failover cluster to have passed these tests before it accepts the cluster as a supported configuration. The report that the tests produce is the first record to consult when a problem occurs in the future.

During the creation, a name and an IP address are defined for the cluster. The wizard creates a computer object with this name in Active Directory (Cluster Name Object, CNO) and adds its record to DNS. For this reason, the account that performs the creation must have permission to create computer objects in the location where the computer accounts of the nodes are.

Step 28 - Create Cluster Wizard and Selecting the Servers

On SRVNODE1, the Failover Cluster Manager console is opened and the Create Cluster link under Management is clicked.

failovercluster

On the Before You Begin information page, Next is clicked.

Windows Server 2012 Hyper-V Failover Cluster installation

On the Select Servers page, the servers that join the cluster are added with the Browse button.

Windows Server 2012 Hyper-V Failover Cluster installation

Windows Server 2012 Hyper-V Failover Cluster installation

Windows Server 2012 Hyper-V Failover Cluster installation

Step 29 - Validation Warning

The Validation Warning page asks whether the validation tests are to be run before the cluster is created. The Yes option directs the wizard to the Validate a Configuration steps. The No option skips the tests and goes directly to the cluster creation steps. Skipping the tests is reasonable if the structure was validated earlier with the same hardware and configuration. Here, Yes is selected.

Windows Server 2012 Hyper-V Failover Cluster installation

Step 30 - Validate a Configuration Wizard

On the Before You Begin information page, Next is clicked.

Windows Server 2012 Hyper-V Failover Cluster installation

On the Testing Options page, all tests or only selected tests can be run. To check the whole configuration, Run all tests is selected.

Windows Server 2012 Hyper-V Failover Cluster installation

The Confirmation page lists the tests that are run. The tests are started by clicking Next.

Windows Server 2012 Hyper-V Failover Cluster installation

The Validating page shows that the tests are running.

Windows Server 2012 Hyper-V Failover Cluster installation

hyper-v failover cluster

The Summary page contains the test results. There are a few warnings but no errors. The full report is opened with the View Report button to see which test each warning comes from.

Windows Server 2012 Hyper-V Failover Cluster installation

Verification Point
No test is in the Failed state on the Summary page. The warnings have been reviewed in the report and their causes are understood.

Step 31 - Access Point for Administering the Cluster

After the tests finish, the wizard asks for a name and an IP address for the cluster. The name of the cluster is entered in the Cluster Name box and the IP address in the Address box, and then Next is clicked. This name and address are the access point that is used to manage the cluster. The virtual machines do not use this name. Each virtual machine provides its service with its own name and IP address.

The IP address of the cluster is assigned from the LAN network, where the management traffic flows, not from the iSCSI network. The name and the IP address must not be in use by another device on the network.

Windows Server 2012 Hyper-V Failover Cluster installation

Step 32 - Confirmation and Creating the Cluster

The Confirmation page shows the name of the cluster, the nodes and the IP address. Next is clicked.

Windows Server 2012 Hyper-V Failover Cluster installation

The cluster is created on the Creating New Cluster page.

Windows Server 2012 Hyper-V Failover Cluster installation

The Summary page states that the cluster was created without problems. The wizard is closed by clicking Finish.

Windows Server 2012 Hyper-V Failover Cluster installation

Step 33 - Checking the Cluster in Failover Cluster Manager

In the Failover Cluster Manager console, the Roles, Nodes, Storage, Networks and Cluster Events sections are now present under the cluster.

Windows Server 2012 Hyper-V Failover Cluster installation

The Nodes section shows the servers that were added to the cluster.

Windows Server 2012 Hyper-V Failover Cluster installation

The Disks section under Storage contains the Quorum and ClusterVolume disks.

Windows Server 2012 Hyper-V Failover Cluster installation

Verification Point
Both nodes are in the Up state in the Nodes section, and both disks are in the Online state in the Disks section.

In a 2-node cluster, the votes of the nodes are equal. When the nodes cannot see each other, a third vote decides which node continues to run. The disk witness provides this vote. 2 nodes and 1 disk witness make 3 votes in total, so when 1 node fails, the remaining node and the witness form the majority and the cluster continues to run. The disk that shows Disk Witness in Quorum in the Assigned To column of the Disks section is the disk that is used for this purpose.

In this lab, the ClusterVolume disk stays under Available Storage and is attached to the role of the virtual machine when the virtual machine is created. In this model, a single node owns the disk, and the disk changes node together with the virtual machine on it.

In a production environment, the disk for the virtual machine disks is added to CSV with Add to Cluster Shared Volumes in the Disks section. With CSV, all nodes access the same volume under C:\ClusterStorage at the same time, and each virtual machine can be moved independently of the others.

9- Creating a Highly Available Virtual Machine

The virtual machine is created from Failover Cluster Manager instead of Hyper-V Manager. The pages of the wizard are the same as in Hyper-V Manager. The difference is that the virtual machine is added to the cluster as a role at the moment it is created. For this to work, the configuration files and the virtual disk of the virtual machine must be on the shared disk that both nodes can reach. If the files stay on the local disk of 1 node, the other node cannot take over the virtual machine.

Step 34 - New Virtual Machine Wizard and Node Selection

In Failover Cluster Manager, Roles is right-clicked and Virtual Machines > New Virtual Machine... is selected.

Windows Server 2012 Hyper-V Failover Cluster installation

In the window that asks on which node the virtual machine is created, SRVNODE1 is selected and OK is clicked.

 hyper-v failover cluster

On the Before You Begin page, Next is clicked to continue.

 hyper-v failover cluster

Step 35 - Specify Name and Location

On the Specify Name and Location page, the virtual machine is named ClusterVM01.

 hyper-v failover cluster

On the same page, the Store the virtual machine in a different location box is selected. This option writes the configuration files of the virtual machine to a specified location instead of the default local folder.

 hyper-v failover cluster

The shared disk is selected with the Browse button.

 hyper-v failover cluster

On the disk, the FiloverClusterVMs folder that was created earlier is selected. The configuration files of the virtual machine are kept in this folder.

 hyper-v failover cluster

The Location line now shows this folder on the shared disk.

 hyper-v failover cluster

Step 36 - Specify Generation

On the Specify Generation page, the virtual machine is defined as Generation 1 or Generation 2. This selection cannot be changed after the virtual machine is created. The default selection is not changed and Next is clicked.

 hyper-v failover cluster

Step 37 - Assign Memory

The Startup memory value on the Assign Memory page is the amount of memory that is allocated when the virtual machine starts. If the value is too low, the operating system has insufficient memory at startup. If it is higher than necessary, the physical memory of the host is used inefficiently.

When the Use Dynamic Memory for this virtual machine option is selected, the virtual machine starts with the Startup value and uses less or more memory according to its needs while it runs. The lower and upper limits are defined in the settings of the virtual machine. The default upper limit is 1048576 MB (1 TB). When the option is not selected, the virtual machine uses the Startup amount of memory as a fixed value for as long as it runs.

In a cluster that uses Dynamic Memory, the planning is done so that all virtual machines fit into the memory of the remaining node when 1 node fails. Otherwise, the virtual machines cannot start after a failover because of insufficient memory.

 hyper-v failover cluster

Step 38 - Configure Networking

The Connection list on the Configure Networking page contains the virtual switches that were created on the host. The switch named FailoverVirtualSwitch, which was created in Step 12, is selected.

 hyper-v failover cluster

Step 39 - Connect Virtual Hard Disk

On the Connect Virtual Hard Disk page, the virtual disk that the virtual machine uses is defined. There are 3 options.

Option What It Does When It Is Used
Create a virtual hard disk Creates a new, dynamically expanding .vhdx file. The name, location and size are entered When the virtual machine is installed from the beginning
Use an existing virtual hard disk Attaches a .vhd or .vhdx file that was created earlier When a prepared fixed size disk or a disk that contains an operating system is used
Attach a virtual hard disk later Creates the virtual machine without a disk When the disk is added later from the settings of the virtual machine

The Create a virtual hard disk option is used here. ClusterVM01.vhdx is entered in the Name box. By default, the Location line shows the C:\Users\Public\Documents\Hyper-V\Virtual Hard Disks\ folder. This folder belongs only to the relevant host, so it is not used in a cluster. The default value in the Size box is 127 GB, and the upper limit that the VHDX format supports is 64 TB. Because the disk expands dynamically, physical space is used only as data is written.

 hyper-v failover cluster

 hyper-v failover cluster

With Browse, the shared disk is opened and the FiloverClusterDisks folder that was created earlier is selected. The disk of the virtual machine is kept in this folder.

 hyper-v failover cluster

The Location line shows the FiloverClusterDisks folder on the shared disk.

 hyper-v failover cluster

Step 40 - Installation Options

On the Installation Options page, the installation source of the operating system is selected. Install an operating system from a boot CD/DVD-ROM is selected, and the installation file in the ISO folder on the shared disk is given as the Image file (.iso) path.

 hyper-v failover cluster

Step 41 - Summary and High Availability Result

The definitions are checked on the summary page. If a value needs to be corrected, Previous can be used to go back. Because there is no problem, Finish is clicked.

 hyper-v failover cluster

The Summary page states that the virtual machine was created successfully and was configured for high availability. The wizard is closed by clicking Finish.

 hyper-v failover cluster

 hyper-v failover cluster

Verification Point
ClusterVM01 is listed in Failover Cluster Manager under Roles as a role of the Virtual Machine type, and the Owner Node column shows SRVNODE1.

Step 42 - Operating System Installation and Test Folders

The console of the virtual machine is opened by right-clicking the virtual machine and selecting Connect....

 hyper-v failover cluster

The virtual machine is started by clicking Start. The Windows Server 2012 R2 setup page opens. After the language, time and currency format, and keyboard options are set, Next is clicked.

 hyper-v failover cluster

The installation is started by clicking Install now.

 hyper-v failover cluster

 hyper-v failover cluster

 hyper-v failover cluster

 hyper-v failover cluster

 hyper-v failover cluster

The installation is complete. The Ctrl+Alt+Delete key combination is sent to open the sign-in page.

 hyper-v failover cluster

 hyper-v failover cluster

After sign-in, the title of the window shows ClusterVM01 on SRVNODE1 - Virtual Machine Connection. The virtual machine runs on SRVNODE1. In this state, 2 test folders are created inside the virtual machine. In the failover test, these folders are checked after the virtual machine moves to SRVNODE2.

 hyper-v failover cluster

10- Failover Test

To confirm that the structure works as expected, the Cluster service is stopped on the node where the virtual machine runs. This operation puts that node in the Down state from the point of view of the cluster, and the roles on it are transferred to the other node.

Stop Cluster Service is a planned transfer, and the cluster itself moves the roles to the other node. In an unplanned situation such as a power failure, the virtual machine is restarted on the other node and a short interruption occurs during this time.

Step 43 - Stopping the Cluster Service on SRVNODE1

In Failover Cluster Manager, SRVNODE1 is right-clicked under Nodes, and Stop Cluster Service is selected under More Actions.

 hyper-v failover cluster

SRVNODE1 is now in the Down state.

 hyper-v failover cluster

Step 44 - State of the VM on SRVNODE2

After SRVNODE1 changes to the Down state, the virtual machine appears in the Running state under Roles. The cluster transferred the roles of SRVNODE1 to SRVNODE2, and the virtual machine now runs on SRVNODE2.

 hyper-v failover cluster

The console of the virtual machine is opened by right-clicking the virtual machine and selecting Connect.... The window title, which showed ClusterVM01 on SRVNODE1 - Virtual Machine Connection before, now shows ClusterVM01 on SRVNODE2 - Virtual Machine Connection. The folders that were created while the virtual machine was on SRVNODE1 are also in place.

No data was copied between the nodes here. The disk file of the virtual machine is on the shared disk. What changed is the node that runs the virtual machine and owns the shared disk. This is the reason why the folders are also visible on SRVNODE2.

 hyper-v failover cluster

 hyper-v failover cluster

The test is also performed in the opposite direction. Before that, while the virtual machine runs on SRVNODE2, a few more folders are created in addition to the existing ones. When the virtual machine returns to SRVNODE1, both the first folders and the newly added ones are expected to be in place.

 hyper-v failover cluster

Step 45 - Stopping the Cluster Service on SRVNODE2

Before this step, the Cluster service must be running again on SRVNODE1 and the node must be in the Up state. Otherwise, no node remains to take over the virtual machine. Then SRVNODE2 is right-clicked under Nodes, and Stop Cluster Service is selected under More Actions.

 hyper-v failover cluster

SRVNODE2 is now in the Down state.

 hyper-v failover cluster

Step 46 - State of the VM on SRVNODE1

After SRVNODE2 changes to the Down state, the virtual machine is again in the Running state under Roles. This time, the roles were transferred to SRVNODE1.

 hyper-v failover cluster

When the console of the virtual machine is opened, the window title again shows ClusterVM01 on SRVNODE1 - Virtual Machine Connection. The folders that were created on SRVNODE1 and the ones that were added on SRVNODE2 are all in place.

 hyper-v failover cluster

 hyper-v failover cluster

Verification Point
The virtual machine moves to the other node in both directions, stays in the Running state, and the folders inside it are complete.

The virtual machine is taken over by the other node in both directions and the data inside it stays in place, so the cluster works as expected. From this point, each virtual machine that is added to the structure is created as a separate role from Failover Cluster Manager. If CSV is not used, as in this lab, a separate cluster disk is allocated for each virtual machine. If the files of more than 1 virtual machine are kept on the same volume, that volume is configured as CSV.

This article walked through the installation of a 2-node Hyper-V failover cluster on Windows Server 2012 R2 in a lab environment from start to finish. The Hyper-V role and the Failover Clustering and Multipath I/O features were installed, an external virtual switch was created with the same name on both nodes, the Quorum and ClusterVolume disks were prepared on the iSCSI Target Server and connected to the nodes, the cluster was created after the validation tests, and the transfer of a highly available virtual machine between both nodes was tested.

I hope you find it useful...

No comments on this article yet. Be the first to comment!

750 characters available.
Security code
Comments are published once approved.
Your email is only used to let you know when your comment is approved. It is never published.