Category Archives: Virtualisation

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.

Removing Failed Machines from System Center Virtual Machine Manager 2008 R2

Following an issue with our five node Server 2008 R2 Hyper-V cluster I was left with two entries for one virtual machine (VM) in System Center Virtual Machine Manager 2008 R2 (SCVMM).  One entry listed the VM as running, the other as failed, despite the fact that there was nothing wrong with the VM.  I was unable to remove the failed entry for the VM using the SCVMM GUI, so used the steps outlined in this KB article http://support.microsoft.com/default.aspx?scid=kb;EN-US;983839 This article is for removing missing VMs, rather than failed ones, so I altered the SQL that is run in step 5.  First I ran the SQL below to retrieve the object state of the failed VM

SELECT ObjectState
FROM dbo.tbl_WLC_VObject
WHERE Name = ‘VMName’

I then ran this code to ensure that I wasn’t going to remove any other VMs.  Only the failed VM should be returned by the code below.  Change the ObjectState value to the value returned by the code above

SELECT Name
FROM dbo.tbl_WLC_VObject
WHERE ObjectState = X

As only one VM was returned, I updated the code at the beginning of step 5 of the KB article and replaced the ObjectState value of 220 with the ObjectState for my failed VM.  I also applied the hotfix here http://support.microsoft.com/kb/2308590 to guard against similar future issues.

Partition above extends beyond the end of disk

I was recently trying to backup a server using Symantec Backup Exec System Recovery (BESR) 2010.  Unfortunately, BESR was refusing to create a backup.  A support call to Symantec pointed us to the PartInfo.exe tool, located in C:\Program Files\Symantec\Backup Exec System Recovery\Utility.  Running this tool creates a text file called partinfo.txt in the same folder.  When PartInfo was run on this particular server it logged the error “Partition above extends beyond the end of disk”.  This machine was a virtual server running on Windows Server 2008 R2 and had converted from a physical machine.  I was able to resolve the error by shutting down the VM and increasing the size of the disk by 1GB (the smallest amount permitted by the System Center Virtual Machine Manager 2008 R2 GUI).  I restarted the VM, re-ran PartInfo and the error was resolved and BESR was able to take backups of the server.