共用方式為


Migrate Pass-Through Disk Storage by Using Hyper-V in Windows Server 2012 R2

 

Applies To: Windows Server 2012 R2

Hyper-V provides a simple way to migrate pass-through disks to a flexible .vhd or .vhdx file format on virtual machines. A pass-through disk refers to a physical hard disk that is directly attached to a virtual machine.

Pass-through disk storage

Hyper-V in Windows Server 2012 R2 supports the use of pass-through disks for virtual machines. The virtual machine connects directly to a physical hard disk for storage.

The physical hard disk that you connect to a virtual machine can also be a network-attached disk, such as a logical unit number (LUN) in a storage area network (SAN).

From the perspective of the management operating system, these pass-through disks are in an “offline” state, which means that direct read and write access to the physical hard disks is not available.

Virtual hard disk file formats

Many organizations choose to store their enterprise workloads in virtual hard disks (VHDs). Hyper-V supports two VHD file formats: the traditional .vhd format and the new .vhdx format.

The .vhdx format has a much larger storage capacity than the older .vhd format. It also provides data corruption protection during power failures and optimizes structural alignments of dynamic and differencing disks to prevent performance degradation on new, large-sector physical hard disks.

Attach a pass-through disk to a virtual machine

Before you begin:

  1. Ensure that the physical hard disk is available. Use Disk Manager to ensure that the physical hard disk is listed as “offline.”

  2. The most important limitation for connecting a pass-through disk 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. The disk is attached to the virtualization server and is in an “offline” state.

Generation 1 and generation 2 virtual machines support pass-through disks. The following procedure uses a generation two virtual machine.

To attach a pass-through disk to the virtual machine

  1. To open Hyper-V Manager, click Start, point to Administrative Tools, and then click Hyper-V Manager.

  2. Select the server running Hyper-V and the virtual machine that you will use to attach the pass-through hard disk.

  3. In the action pane, click Settings, and then click SCSI Controller.

  4. Click Hard Drive, and then click Add.

  5. Click Physical hard disk, and select the pass-through disk from available physical hard disks.

  6. Click OK. The pass-through hard disk is now connected to the virtual machine.

Convert pass-through disks to .vhdx file format

Generation 1 and generation 2 virtual machines support converting pass-through disks to a virtual hard disk file. The following procedure details how to convert a pass-through disk to the .vhdx file format on a generation 2 virtual machine.

Before you begin:

  1. Ensure that you shut down the virtual machine that is connected to the pass-through disk.

  2. Make sure you have sufficient hard disk space to store the new VHDX file when it is converted.

To convert a pass-through disk to the .vhdx file formatThe procedure title

  1. To open Hyper-V Manager, click Start, point to Administrative Tools, and then click Hyper-V Manager.

  2. Select the server running Hyper-V that contains the virtual machine with the pass-through physical hard disk.

  3. In the action pane, click New, and then click Hard Disk.

  4. The New Virtual Hard Disk Wizard appears. Click Next.

  5. Click VHDX, and then click Next.

  6. Keep the default disk type, which is Dynamically expanding, and then click Next.

  7. Specify the Name and Location of the new VHDX file, and then click Next.

  8. Click Copy the contents of the specified physical disk.

  9. Click the name of the appropriate offline physical hard disk from the available physical hard disks, and then click Next.

  10. Click Finish.

The contents of the pass-through disk or the direct-attached storage disk will be converted to the .vhdx file format. This might take some time depending on the size.

Attach VHDX file to virtual machine

Important

Before attaching the new VHDX file to your virtual machine, ensure that you disconnect your original pass-through disk.

After the contents of the pass-through disk or direct-attached storage disk are completely copied, you can attach the VHDX file to your virtual machine.

To attach the VHDX file to your virtual machine

  1. To open Hyper-V Manager, click Start, point to Administrative Tools, and then click Hyper-V Manager.

  2. Select the server running Hyper-V and the pass-through disk that is currently attached to your virtual machine.

  3. In the action pane, click Settings, and then click Hard Disk.

  4. Under Media, click Virtual Hard Disk, and choose the hard disk controller.

  5. Click Browse, navigate to the VHDX file, click Open, and then click OK.

The VHDX file that was successfully migrated from pass-through disk is now connected to the virtual machine. You can now restart the virtual machine.

See Also

Virtual hard disk format