Share via


Connect a Physical Hard Disk to a Virtual Machine

Applies To: Windows Server 2008 R2

Your virtual machines can also be connected to physical hard disks on the virtualization server—not just to virtual hard disks. (This is sometimes referred to as having a “pass-through” disk connected to a virtual machine.)

The physical hard disk that you connect to a virtual machine can also be a network-attached disk, like a logical unit number (LUN) in a storage area network (SAN). A common example is an iSCSI LUN that has been mapped to the virtualization server by using Microsoft iSCSI Initiator. Because the virtualization server sees network-attached storage as local disks, the iSCSI LUN can be connected to a virtual machine.

Important

The most important limitation about having a physical hard disk connected to a virtual machine is that it cannot be connected to the virtualization server or to other virtual machines at the same time. The virtual machine must have exclusive access to the physical hard disk.

Note

For more information about connecting network-attached storage to the virtualization server by using Microsoft iSCSI Initiator, see the Microsoft iSCSI Initiator Step-by-Step Guide (https://go.microsoft.com/fwlink/?LinkID=182862).

Scenario prerequisites

To test this scenario, you will need the following:

  • Complete all steps in the main section of this guide. After you complete all the steps, you will have a virtualization server and two virtual machines: Base Virtual Machine (used for creating new virtual machines) and Imported Virtual Machine.

  • Imported Virtual Machine is running, Windows Server 2008 R2 is configured, and the computer name for the virtual machine is VirtualMachine1.

  • Make available a hard disk drive on the virtualization server that is not currently used for other tasks and can be temporarily disconnected from the virtualization server. Alternatively, use a network-attached disk or LUN that is already mapped to the virtualization server.

Scenario steps

The following procedure explains how to connect a physical hard disk on the virtualization server to a virtual machine.

To connect a physical hard disk to a virtual machine

  1. On the virtualization server, take the physical hard disk offline by using Disk Management:

Warning

To avoid losing data, before you take a physical hard disk offline, stop all applications on the virtualization server that read or write data to that hard disk.

1.  Open Server Manager. Click **Start**, point to **Administrative Tools**, and then click **Server Manager**.  
      
2.  In Server Manager, in the console tree, under **Storage**, click **Disk Management**.  
      
3.  After the disks on the virtualization server are listed in Disk Management, locate and determine if the physical disk that you want to attach to the virtual machine is online. The state of the disk (**Online** or **Offline**) is listed in the small pane on the left, where the disk name, disk type, and disk size are also listed.  
      
4.  If the disk is online, to take the disk offline, right-click the disk, and then click **Offline**. After the disk state changes to **Offline**, the disk is disconnected from the virtualization server.  
      

Note

To perform actions on a disk in Disk Management, you must right-click the small pane on the left, where the disk name, disk type, disk size, and disk state are listed.

  1. Connect the physical hard disk to the SCSI controller of the Imported Virtual Machine virtual machine, as follows:

Note

Connecting a disk to the SCSI controller of a virtual machine instead of an IDE controller enables you to perform this action without having to first shut down the virtual machine. For more information, see Connect a Virtual Hard Disk to a Virtual Machine Without Shutting It Down, in this guide.

1.  On the virtualization server, open Hyper-V Manager. Click **Start**, point to **Administrative Tools**, and then click **Hyper-V Manager**.  
      
2.  In Hyper-V Manager, under **Virtual Machines**, right-click **Imported Virtual Machine**, and then click **Settings**. The **Settings for Imported Virtual Machine** dialog box appears.  
      
3.  In the left navigation pane, click **SCSI Controller**.  
      
4.  In **SCSI Controller**, click **Hard Drive**, and then click **Add**. A hard drive is added to the SCSI controller and is automatically selected in the left navigation pane.  
      
5.  In the **Hard Drive** properties, click **Physical hard disk**, and then select the physical disk that you took offline.  
      
6.  To connect the physical hard disk to the virtual machine, click **OK**. The physical hard disk is now available on the virtual machine, and can be accessed to read and write information.  
      
  1. To disconnect the physical hard disk from the virtual machine:

Warning

To avoid losing data, before you disconnect a physical hard disk from a virtual machine, stop all applications on the virtual machine that read or write data to the physical hard disk.

1.  In Hyper-V Manager, under **Virtual Machines**, right-click **Imported Virtual Machine**, and then click **Settings**. The **Settings for Imported Virtual Machine** dialog box appears.  
      
2.  In the left navigation pane, under **SCSI Controller**, click the physical hard disk that you want to detach from the virtual machine.  
      
3.  In the **Hard Drive** properties, click **Remove**.  
      
4.  To detach the physical hard disk from the virtual machine, click **OK**.