How to convert Physical Disk to Virtual Disk


Disk2vhd v1.63

 

How to convert Physical Disk to Virtual Disk

Introduction

Disk2vhd is a utility that creates VHD (Virtual Hard Disk – Microsoft’s Virtual Machine disk format) versions of physical disks for use in Microsoft Virtual PC or Microsoft Hyper-V virtual machines (VMs). The difference between Disk2vhd and other physical-to-virtual tools is that you can run Disk2vhd on a system that’s online. Disk2vhd uses Windows’ Volume Snapshot capability, introduced in Windows XP, to create consistent point-in-time snapshots of the volumes you want to include in a conversion. You can even have Disk2vhd create the VHDs on local volumes, even ones being converted (though performance is better when the VHD is on a disk different than ones being converted).

The Zip file

http://download.sysinternals.com/files/Disk2vhd.zip

the exe file

 

http://live.sysinternals.com/Disk2vhd.exe

The Disk2vhd user interface lists the volumes present on the system:


It will create one VHD for each disk on which selected volumes reside. It preserves the partitioning information of the disk, but only copies the data contents for volumes on the disk that are selected. This enables you to capture just system volumes and exclude data volumes, for example.

Note: Virtual PC supports a maximum virtual disk size of 127GB. If you create a VHD from a larger disk it will not be accessible from a Virtual PC VM.

To use VHDs produced by Disk2vhd, create a VM with the desired characteristics and add the VHDs to the VM’s configuration as IDE disks. On first boot, a VM booting a captured copy of Windows will detect the VM’s hardware and automatically install drivers, if present in the image. If the required drivers are not present, install them via the Virtual PC or Hyper-V integration components. You can also attach to VHDs using the Windows 7 or Windows Server 2008 R2 Disk Management or Diskpart utilities.

Note: do not attach to VHDs on the same system on which you created them if you plan on booting from them. If you do so, Windows will assign the VHD a new disk signature to avoid a collision with the signature of the VHD’s source disk. Windows references disks in the boot configuration database (BCD) by disk signature, so when that happens Windows booted in a VM will fail to locate the boot disk.

Disk2vhd runs Windows XP SP2, Windows Server 2003 SP1, and higher, including x64 systems.

Here’s a screenshot of a copy of a Windows Server 2008 R2 Hyper-V system running in a virtual machine on top of the system it was made 

from:


 

http://download.sysinternals.com/files/Disk2vhd.zip

 

Advertisements

Clone virtual machines in Hyper-V


Clone virtual machines in Hyper-V

As you know Hyper-V does not have an option to clone virtual machines, except when you use SCVMM. Because of this many administrator need to use tricks so they don’t have to install and configure a new virtual machine from scratch every time they need a copy of Windows 7, or any other operating system. In this guide I’m going to show you two of the most popular ones, and they free. For this lab I have a Hyper-V server running on Windows Server 2008 R2 SP1, and a Windows 7 machine (reference machine) for cloning calledWindows.7.Enterprise.

In this first example is important that the virtual machine should not have snapshots. The reference virtual machine (Windows.7.Enterprise) is located on the Hyper-V host C: drive, in a folder called HV-Machines. Inside HV-Machines folder create another folder and give it a distinctive name, so you can recognize it. I called mine Windows 7 Clone. Now copy the virtual disk (the *.vhd file) from the Windows.7.Enterprisemachine to the Windows 7 Clone folder. If you want to, you can rename the copied virtual disk after the folder name, but is not necessary, is just that I like to have the virtual disk files named after the virtual machine that I will create.   





Open Hyper-V manager and create a new virtual machine from the Actions pane. Give the virtual machine a name, and I recommend you name the virtual machine after the folder we just created “Windows 7 Clone”. It will be much easier when troubleshooting. Now choose to store the virtual machine in the folder “Windows 7 Clone”. This is only if you want to have the configuration files and the virtual disk in the same folder.

   

Continue the wizard until you reach the Connect Virtual Hard Disk page. Here instead of creating a new virtual disk we will go with the second option and use an existing virtual disk. Click the Browse button and select the virtual disk we just copied in the “Windows 7 Clone” folder.

   

Finish the wizard. Now we have an exact copy of the reference virtual machine. Don’t forget to change its name an IP address, if is a static one.

  

In the second example we are going to use the Hyper-V export function to clone the virtual machine. Using this method you can have snapshots and still being able to clone the machine. To start click the reference virtual machine (Windows.7.Enterprise) in the Hyper-V console, then in the Actions pane click the Export link.




On the Export Virtual Machine window click the Browse button and choose a place where to save this virtual machine, then click Export to start the process. Is going to take a while so be patient. When the export process is finished the Cancel export link in the Actions pane will disappear.

   

Back in Hyper-V manager console click the link Import Virtual Machine in the Actions pane.

   

In the window that opens we have two radio buttons and a check box. The first radio button, Move or restore the virtual machine (use the existing unique ID) is going to import the virtual machine and preserve its ID’s. This option is used when importing to a different Hyper-V server. If you import a virtual machine, and on the same Hyper-V server that ID already exists you will get an error message, and the import process fails.

   

The second radio button, Copy the virtual machine (create a new unique ID), like the name implies, it will create a new ID for the virtual machine you are importing. This is used when you use the same Hyper-V host to export and import virtual machines, like in our case. The check box is there if you want to import the same virtual machine for more than one time, without going through the export process again. Since we are using the same Hyper-V host to import the virtual machine, and another one (the reference machine) exists with the same ID, select the second radio button. Now click Browse and select the exported virtual machine folder, then hit Import. I changed the folder name because this is how I’m going to call my virtual machine in the Hyper-V console.

 

    

Looks like I have a warning message after the import process finished. This is because I forgot to unmount the Windows 7 ISO from the reference virtual machine before exporting. I’ll just ignore it and click Close.

The last step is to rename the virtual machine in the Hyper-V console so we can distinguish it from the original one. Again don’t forget to change its name and IP address if is a static IP.

http://social.technet.microsoft.com/wiki/contents/articles/11902.clone-virtual-machines-in-hyper-v.aspx