Moving a Hyper-V Virtual Machine Storage to a Cluster Volume using PowerShell.

I have a Virtual Machine ADS00 running a guest OS WS 2012 R2 .It’s vhdx file is located on a Failover Cluster node physical server running Hyper-V Core 2012 R2. As the services offered and requirements for this VM continued to scale, we decided to migrate it to the Cluster volume and make it highly available in the Failover Cluster. The steps to achieving this objective are outlined as follows:

1) Login to the VMHost Host00 and verify that the guest VM CMS00 is running normally:

VMStorage1

2) Determine the current storage path of the guest VM CMS00:

PS C:\> Get-VMHardDiskDrive -ComputerName host00 -VMName cms00 | fl

VMStorage

3) Use the Move-VMStorage cmdlet to relocate the guest VM’s storage to the predetermined cluster storage volume.

VMStorage2

The -Vhds parameter accepts a hashtable of the sourcefilepath with it’s corresponding value and the destinationfilepath with it’s value. Use the Get-VMHardDiskDrive cmdlet to verify the new path . From the above screen shot, we can confirm that the new storage path has changed to the cluster volume after the move operation.

4) After the move, use the Add-ClusterVirtualMachineRole cmdlet to add the VM ADS00 as a Cluster role and complete the process of making it highly available .

VMStorage3

5) Additionally, I enabled Hyper-v replication on the new Cluster role (ADS00 virtual machine) using Failover Cluster Manager to a Replica Server running WS 2012 R2. I had initially setup a Hyper-V broker for the Cluster to facilitate this process.

Advertisement
This entry was posted in Failover Cluster, Failover Cluster Manager, Generation 2 Virtual Machines, Hyper-v 2012 R2, Hyper-v Manager, Hypervisor Replication, Microsoft Hyper-v, Migration, PowerShell, Powershell 4.0, VHDX, Virtual Machines, VM Replica, Windows Server 2012 R2 and tagged , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s