Category Archives: Virtualisation

Deleting Hyper-V Snapshots

An important point when deleting a Hyper-V snapshot is that the corresponding AVHD file isn’t merged into the main VHD file until you power down the server.  This means that the disk space used by the snapshot isn’t immediately available when you delete a snapshot.

As far as I’m aware there’s no way to monitor the merge process through System Center Virtual Machine Manager, but you can via the Hyper-V MMC.

If you start a virtual machine during the merge process, the merge process stops and the machine starts instantly.




Unable to “Turn off redirected access for this Cluster shared volume”

Our five node Hyper-V cluster is connected to a Dell MD3000i, which provides virtual machine storage using Cluster Shared Volumes (CSV).  The MD3000i has dual storage controllers for redundancy, but recently both storage controllers rebooted within a minute of each other.  Looking at the Storage section of Failover Cluster Manager showed that half the CSV volumes had a status of Redirected Access.  Reading this blog showed that the first thing to try was to “Turn off redirected access for this Cluster shared volume”, unfortunately this didn’t work.  I looked in Disk Management on each of the five nodes, which looked as below:

Each node should be able to see all the disks, but only the first node, the one on the far left, could see all five disks.  I live migrated the virtual machines off each node and rebooted each node one at a time.  Once completed, Disk Management looked like this:


Every node can see all five disks.  I checked Failover Cluster Manager and all the CSV volumes had returned to Online status automatically.

Cluster Shared Volumes Issue

Following a power down of our Hyper-V cluster, about half the virtual machines  (VMs) would not start.  Looking in Failover Cluster Manager showed  the VMs couldn’t start because the machine files were missing.  I looked at the Storage summary, but the cluster shared volumes were present and had a status of online:

This was odd, Failover Cluster Manager was saying the VM files were missing, but the disks were online.  I expanded the cluster shared volumes (CSV):

If you look at the CSV paths, you’ll see the path for Cluster Disk 1 is C:\ClusterStorage\Volume1 and the path for Cluster Disk 3 is C:\ClusterStorage\.  The reason the machines wouldn’t start was because the Cluster Disk 3 path was incorrect.  It should have been C:\ClusterStorage\Volume2.

I right-clicked on Cluster Disk 3, chose “Move this shared volume to another node” and selected one of the other cluster nodes.  When the move had completed, the path was correct and I was able to start the VMs.

Removing A Failed Disk Resource From A Failover Cluster

Two virtual disks failed on the storage used by our Windows Server 2008 R2 Hyper-V cluster.  I wasn’t able to recover the virtual disks, so I needed to remove them from the cluster.  I had to use a different method for each disk. 

The cluster uses Cluster Shared Volumes, so using Failover Cluster Manager, I opened Cluster Shared Volumes, right-clicked on the first disk and selected “Remove from Cluster Shared Volumes” (This option was only available when the cluster was attempting to bring the disk online).  The disk was then listed as Failed under Available Storage, in the Storage section of Failover Cluster Manager.  I was then able to right-click on the disk and select Delete.

The second disk was continuously listed as Failed in Cluster Shared Volumes, so I wasn’t able to select the “Remove from Cluster Shared Volumes” option.  I had to remove this disk from Cluster Shared Volumes using PowerShell.  I opened PowerShell, and imported the Failover Cluster module into PowerShell by typing Import-Module FailoverClusters .  Next, I typed Remove-ClusterSharedVolume “Cluster Disk 4” to remove the failed disk from Cluster Shared Volumes.  The disk was then listed as Failed under Available Storage, in the Storage section of Failover Cluster Manager.  I then typed Remove-ClusterResource “Cluster Disk 4” to remove the disk from the cluster.

PXE Boot a Virtual Machine In Hyper-V 2008 R2

PXE boot is not available in Hyper-V 2008 R2 when using a Synthetic Network Adapter.  In order to PXE boot a virtual machine (VM), you need to turn off the VM and add a Legacy Network Adapter.  If the VM is an existing machine with a bootable hard disk, you’ll also need to change the boot order, so PXE Boot is above IDE Hard Drive.

Reporting Virtual Machine Dynamic Disk Space Using PowerShell And System Center Virtual Machine Manager 2008 R2

Dynamically expanding disks enable you to thin provision virtual machines (VMs)  storage.  This means you can pack more VMs onto a given amount of disk, but you need to ensure that if you provision more storage than is physically available, you don’t run out of space on the host.  The PowerShell script below produces a csv file showing the space available for growth on each VM with a dynamically expanding disk.  You can use this script to see how much space could still be used by your VMs and therefore see if you’re likely to run out of space on the host.  It’ll also show you if a dynamic disk is about to reach it’s maximum size.

Load PowerShell from the icon in the SCVMM console

Next copy and paste the code below into the PowerShell console, replacing VMMHOST with the name of your SCVMM host and the path of the csv file as appropriate.

Get-VirtualHardDisk -VMMServer VMMHOST -All | Select-Object @{Label=”VM Host”;Expression={$_.VMHost}},@{Label=”Name”;Expression={$_.Name}},@{Label=”Space To Grow”;Expression={[Math]::Truncate(($_.MaximumSize-$_.Size) / 1GB)}},@{Label=”VHDType”;Expression={$_.VHDType}} | Where-Object {($_.VHDType -Match “DynamicallyExpanding” -And $_.Name -NotMatch “{“)} | Sort-Object “Space To Grow” -Descending |  Export-Csv C:\DiskInformation.csv

Opening the csv in Excel produces


The PowerShell script is a one liner and breaks down as follows:

Get-VirtualHardDisk -VMMServer VMMHOST -All | Gets the virtual disk for the VMMServer specified

Select-Object @{Label=”VM Host”;Expression={$_.VMHost}},@{Label=”Name”;Expression={$_.Name}},@{Label=”Space To Grow”;Expression={[Math]::Truncate(($_.MaximumSize-$_.Size) / 1GB)}},@{Label=”VHDType”;Expression={$_.VHDType}} | Selects the VM host name, disk name, calculates the maximum disk size – current disk size and converts to GB, VHD type

Where-Object {($_.VHDType -Match “DynamicallyExpanding” -And $_.Name -NotMatch “{“)} | Filters the results to only include dynamically expanding disks whose names don’t start {

Sort-Object “Space To Grow” -Descending | Sorts the output by space to grow, descending

Export-Csv C:\DiskInformation.csv Exports the results to a csv file


Adding Storage To A Failover Cluster For Use With Hyper-V And Cluster Shared Volumes

In this post I’ll walk you through the process of adding storage to a Windows Server 2008 R2 Failover Cluster for use with Hyper-V.   Cluster Shared Volumes (CSV) is only supported with Hyper-V and enables multiple cluster nodes to read and write to the same volume at the same time.  Hyper-V supports the Live Migration of virtual machines (VMs) using CSV.  The cluster used in this example is a five node cluster that’s already been fully configured and is running VMs.  I’m just adding additional storage, but if you were starting from scratch with a new Failover Cluster the process would be the same except you’d need to enable CSV, whereas in my configuration it’s already enabled.

Firstly configure the shared storage so it’s accessible by all cluster nodes.  In my example I’m using a Dell PowerVault MD3000i iSCSI array.  All the cluster nodes have been added to a host group, which has in turn been given access to the virtual disks I want to use in the cluster.  You can confirm that each cluster node has access to the storage by checking in Disk Management.  The disks will be listed as Offline on each cluster node.

On one cluster node, right-click on the section with the disk name and choose online

Next click in the same place and choose Initialize Disk.  I choose GPT as it supports disks larger than 2TB.

Open Failover Cluster Manager, right-click on Storage and Choose Add Disk.  Select the disks to be added and click OK

Check which cluster node owns the disk by clicking on Storage in the left menu

On the sever that’s the owner of the disk you want to add, open Disk Management and create a Simple Volume on each disk.  Do not assign a drive letter or path as it isn’t necessary, then format the partition as NTFS.

If you haven’t already enabled CSV, do so now by right-clicking on the cluster name in Failover Cluster Manager and clicking Enable Cluster Shared Volumes.

In Failover Cluster Manager, go to Cluster Shared Volumes, right-click and choose Add Storage

The storage is now available for VM placement.