'

Hyper-V V2V: Passthrough Disk to VHD Image.

June 14th, 2016 by Andrea Matesi 539 Views

 

Someday I had a VM installed on a passthrough Hard Disk Drive.

Some weekend, instead of going out, I decided I required that bloody drive to experiment "some more" ('though, a compassionate hoarder feeling inside of me didn't want to bork that OS).

My solution was to migrate my Virtual Machine into a VHD image (so I could finally reclaim that unused hdd space back!).

The virtualised OS was an instance of Microsoft Windows Server 2008 R2 SP1 (but your flavour may vary).

Win2k8R2SP1 was installed within a 111GB Passthrough Hard Disk Drive.

A Virtual Machine hosted within a Windows Server Standard 2008 R2 SP1 with the Hyper-V Role enabled was booting off the passthrough Hard Disk Drive.

 

Endless possibilities.

There are 2 ways (that I know of...), to accomplish the Passthrough to VHD migration:

  1. With Disk2vhd from sysinternals.
  2. With "New Disk Wizard" from Hyper-V (no additional software required).

I found not using additional software was more convenient (but this shall not influence you decision, since I reckon it is just a matter of personal preference).

 

Disk2vhd-method.

To migrate a physical Passthrough hard disk drive to a VHD image with disk2vhd, you simply:

  1. Assess the amount of data to be transferred (ie. From & To).
  2. Shutdown the VM to be migrated (make sure you Shut it Down - ie. do not Turn it Off!).
  3. Open "Disk Management" (diskmgmt.msc) on your Hyper-V Host.
  4. Locate the Hard Disk Drive to be migrated.
  5. Update the disk (to be imaged) status to "online" (so the Hyper-V Host can see it).
  6. Win + E Then Paste: "http://live.sysinternals.com/" On your Windows Explorer Address Bar (courtesy of WebDAV!).

Disk2VHD

Disk2vhd will list all your (hdds') partitions.

  1. Locate your disk's partitions from the "Volumes to include"-list and select the partiotions by putting a checkmark on them.
  2. Click on the "..."-Button to Browse for the location where to save the VHD image of your passthrough hdd (make sure - again - there's plenty of space!).
  3. Click on the "Create"-Button to generate the VHD image of your VM.

Now get some of your favourite nuts while waiting & you're done!

 

Hyper-V Method.

Here I'll show a step-by-step howto migrate a physical Passthrough hard disk drive to a VHD image with my favourite Hyper-V Method.

Open Hyper-V Manager & Launch the "New Hard Disk Wizard".

yep, even if you wish to "copy" a passthrough...

Click on "New..." and Select Hard Disk (that's right - just as if you wanted to create a "new" Hard Disk).

The "New Virtual Hard Disk Wizard" will start.

Proceed as follows...
Always "as-if"!

On disk type, Select "Dynamically Expanding" (to create a space-"optimized" image - ie. one which takes less space).

Feel free to choose "Fixed" if you want a FULL image (because, you know, you have more than "plenty of space").

Click Next to proceed to "Specify Name & Location".

 

 

Make sure you have plenty of space.

Specify the VHD Image Name and Location.

My VHD image has been named famx11 (same as the parent VM). What's your naming convention? Good, stick with it!

 

Below is the crucial part: when you choose to create a new VHD, you are can either "Create a new blank virtual hard disk" or "Copy the contents of [a pre-existing] physical disk" (even 'though Disk Management reports the disk as OFFLINE!).

There it is!!!

Select your Passthrough Hard Disk Drive you wish to migrate to a VHD.

Here I selected my 111GB "PHYSICALDRIVE2".

 

Prepare for a nice quarter...

Click on Finish to start the Image creation process.

A new dialog window will show you another meaningless progress bar which I suggest you don't stare at - just grab some chips!

Grab a cuppa!

Once the image creation process has finished, I strongly recommend you to test the image (ie. Before moving it to, say, your NAS).

 

Always trust but always verify...

To Test you VHD Image, on Hyper-V Manager.

  • Open the VM Settings to which the passthrough hdd is attached to.
  • Remove (but don't delete yet), the passthrough hdd from your VM.
  • Attach the VHD image (ie. replace the passthrough disk with the VHD Image).
  • Start the VM and check that your VM boots as expected.

Did I already tell you that the above is incredibly easy?

Posted in Microsoft, System Administration | No Comments »

Leave a Reply

Your email address will not be published. Required fields are marked *

Connect with Facebook