Create a Virtual Windows image

From AFP548 Wiki
Jump to navigation Jump to search

This article describes how to convert current Windows images into virtual harddrive images to use in VirtualBox and VMware Fusion. This guide has been tested on Windows 7 images, but should work on virtual Windows 8 images as well.

Virtual Machine software[edit]

Use of Virtual Machines in OS X is the main reason we need to create virtual Windows 7 images. There are 3 major players which include: Oracle VirtualBox, VMware Fusion, and Parallels Desktop.

VirtualBox is recommended because it’s free to use: https://www.virtualbox.org/wiki/Licensing_FAQ:
So in addition to the personal use which is always permitted, academic institutions may also choose to roll out the software in an automated way to make it available to its students and personnel.

VirtualBox also has a powerful command line interface which allows you the option to script VM configurations. Checkout VBoxManage: https://www.virtualbox.org/manual/ch08.html

Lastly VirtualBox, supports 4 different virtual harddrive formats: VDI, VHD, VMDK, HDD (file formats for Oracle VirtualBox, Microsoft VirtualPC, VMWare Workstation/Fusion, and Parallels Desktop, respectively)

Create a VHD file[edit]

For this process, you will need:


Let's get started:

  1. Create a Windows image. Instructions on how to create a Windows image out of the scope of this guide.
  2. Apply the image to a harddrive using the Windows imaging deployment tool of your choice. Do NOT boot harddrive. Please make sure to use harddrive with 80GB or more of free space. The size of the harddrive will determine how big the virtual harddrive will expand to. Recommended size would be at least a 80GB HDD so that the user can install updates and additional programs as needed.
  3. Once the Windows 7 image has been restored to the external USB HDD, download Disk2VHD. Make sure that the USB HDD is mounted on your computer before proceeding.
  4. Open up Disk2VHD.
  5. Under VHD File name:, select the path of where you wish to save the VHD image file.
  6. Under Volumes to include:, select the drive that has the Windows image you wish to convert to a virtual image.
  7. Click Create and wait until a VHD file is created.
    Note: A .VHD file is mountable in Windows 7 using Disk Management console

This VHD can now be loaded into VirtualBox.

Create a VMDK file[edit]

The VHD file is compatible with VirtualBox. However, it will not open up in other programs like VMware Fusion. In order to get a virtual image that can be used in VMware Fusion.

  1. Once Disk2VHD has finished creating the VHD image, download and install StarWind V2V Image Converter.
  2. Open StarWind V2V Image Converter. You will go through a wizard to determine what kind of image you wish to convert.
  3. Select the source file which will be your VHD image you previously created. Click Next.
  4. Destination image format should be VMWare growable image. This creates a VMDK image where disk space for this image is allocated on demand, so disk size of this image grows over time to the maximum size of the original HDD the image was restored to. Click Next.
  5. Virtual disk type: should be IDE. Click Next.
  6. Select the folder where you wish to save the output file. Make sure you have enough space on your harddrive to save this file. Click Next and wait for the virtual VMDK image to be created.

This VMDK can now be loaded into VMware Fusion.
This VMDK can also be loaded into VirtualBox. Instead of using a VHD, just use the VMDK image file.

Converting Windows 7 images using VBoxManage[edit]

You can also convert Windows 7 images using a command line interface. Use VirtualBox’s VBoxManage to convert Windows 7 images to virtual images. Please read more about the commands needed: https://www.virtualbox.org/manual/ch08.html#vboxmanage-clonevdi

Command and parameters for use in Terminal.app located in /Applications/Utilities/:
VBoxManage clonehd [existing file] [outputfile] –format [VDI|VMDK|VHD|RAW|<other>]

So as an example:
VBoxManage clonehd /Macintosh HD/Users/Admin/Desktop/Windows7.vhd /Macintosh HD/Users/Admin/Desktop/Windows7.vmdk –format VMDK would give me a file called Windows7.vdmk.

This file will work in VirtualBox and VMWware Fusion. However, if using VMware Fusion to use a converted VMDK using above method:

  1. Create the VM first.
  2. Shutdown the VM (don’t just suspend/sleep the VM).
  3. Replace the .vmdk with the one created using VBoxManage.
    1. Go to your Virtual Machine folder usually located in /Users/<account_name>/Virtual Machines/
    2. Open the .vmwarevm by right-clicking (ctrl + click) and click Show Package Contents.
    3. Replace the .vmdk file(s) with the one created using VBoxManage. Make sure the VMDK you created has same exact file name as the one you are replacing.

Notes about other products for conversion[edit]

Disk2VHD:
http://technet.microsoft.com/en-us/sysinternals/ee656415
Takes hard drive and converts it into a .VHD file
.VHD file is mountable in Windows 7

StarWind V2V Image Converter (VHD/VMDK/IMG (Raw Image)):
http://www.starwindsoftware.com/converter
Converts to an older version of VMDK. VMware Fusion detects this and will give you option to update.

VMware Converter:
http://www.vmware.com/products/converter/

Parallels Transporter agent:
http://www.parallels.com/download/desktop/

WinImage:
http://www.winimage.com/download.htm
Keep in mind during conversion that some tools may utilize the size of the HDD as its maximum storage capacity and/or may make the virtual hard drive image size fixed rather than dynamic/flexible.