Wednesday, February 26, 2014

Configure pass-through disks in Windows Server 2012 or Windows Server 2012 R2 with Hyper-V role

Pass-through disks for a virtual machine is not a new technology. It started in Windows Server 2008 with Hyper-V. Pass-through disks is a feature to allow a virtual machine to attach a physical disk. Using a physical disk in a virtual machine will benefit from more disk space (more than 64TB). 

However, administrators need to be aware of some limitation in a virtual machine which is attached a physical disk. 

  • A virtual machine cannot take a checkpoint (Snapshot)
  • A virtual machine isn't supported VSS snapshots backup. Administrators need to install a backup agent in a virtual machine to back up data in a pass-through disk

In Windows Server 2012 or R2, administrators can use GUI or perform cmdlet to attach a physical disk to a virtual machine.

Goal

  • Add a physical disk in a virtual machine in a standalone Hyper-V
  • Add a physical disk in a virtual machine in a clustered Hyper-V

GUI
1. To use pass-through disks for a virtual machine, a physical hard disk should be set to offline mode.


2. In the settings of a virtual machine, we can select the "Physical hard disk" option.



PowerShell
1. Launch "PowerShell" as administrator in a Hyper-V host.
2. Perform "Get-Disk" to check the disk status.


3. Perform "Add-VMHardDiskDrive -VMName <VMName> -ControllerType <SCSI or IDE> -ControllerNumber <Controller number> -DiskNumber <Physical Disk number> -Passthru" to add a physical disk to a virtual machine.


Cluster environment
To add a physical disk to a virtual machine which is in a cluster environment, the physical disk should be added in a cluster. To add a physical disk to a cluster, the physical disk should be initialized.


For more information about storage for Failover Cluster in Windows Server 2012 or R2, please read Failover Clustering Hardware Requirements and Storage Options

GUI
1. Launch "Failover Cluster Manager".
2. On "Failover Cluster Manager" window, select "Disks".
3. Next to "Actions" pane, click "Add Disk".


4. On "Add Disks to a Cluster" window, check a disk, click "OK".



5. Right-click "Roles", select "Configure Role".


6. On "Before You Begin" window, click "Next".


7. On "Select Role" window, select "Virtual Machine".


8. Click "Next".
9. Check a virtual machine which you want to add into a cluster.


10. Click "Next".
11. On "Confirmation" window, click "Next".
12. On "Summary" window, click "Finish".



13. Right-click a virtual machine, select "Settings".


14. Next to "SCSI Controller" or "IDE Controller", select "Physical hard disk".


15. Click "OK".


As a result, a physical disk has been added into a virtual machine in a cluster.

PowerShell
1. Launch "PowerShell" as administrator in a clustered Hyper-V host.
2. Perform "Get-ClusterAvailableDisk" to check a disk which can be added into a cluster.


3. Perform "Get-ClusterAvailableDisk | Add-ClusterDisk -Cluster <Cluster Name>" to add physical disks into a cluster.


4. Perform "Get-ClusterResource" to check the physical disk.


As this moment, the physical disk, Cluster Disk 1, is under "Available Storage" group.

5. Perform "Add-VMToCluster -VMName <VMName> -Cluster <Cluster Name>" to add an existing virtual machine into a cluster.


6. Perform "Add-VMHardDiskDrive -VMName <VMName> -ControllerType <SCSI or IDE> -ControllerNumber <Controller number> -DiskNumber <Physical Disk number> -AllowUnverifiedPaths -Passthru" to add a physical disk to a virtual machine in a cluster environment.


7. Perform "Get-ClusterResource" to check the physical disk.


As a result, the physical disk was added into a virtual machine.

More information
Add-VMHardDiskDrive

How to add a Pass-through disk to a Highly Available Virtual Machine running on a Windows Server 2012 R2 Failover Cluster

This posting is provided “AS IS” with no warranties, and confers no rights!

No comments:

Post a Comment