Creating a virtual image from an existing Windows Installation

Use of virtual machines has greatly improved the lives of several administrators and developers. Virtual machines provide for efficiency and security and are a good way to save time and money. Microsoft has given users options for creating and using virtual machines through Microsoft Virtual PC or Microsoft Hyper-V. However these virtual machines do not come with images, hence the necessity to create them. One can always install an image or visit one or more sites that provide various images in vhd format for download. The vhd format can then be imported as a virtual machine.

Possibilities are infinite, and you can opt to create your own virtual machine designed to your specification. To achieve this you will use Disk2vhd, created by Sysinternals. Systeminternals have a reputation of developing some great software.  In this tutorial we will be creating a virtual image from your own running Windows Installation and use it as an image.

How it works

Disk2vhd is  a cool application from Systeminternals that can create vhd images from any drive attached to your computer so long as the drive has the necessary files to create a virtual image. How is this possible? This tool works with the help of Windows’ Volume Snapshot found in any Microsoft Windows Operating System from XP and later. To enhance performance during the creation of the image, it is advisable to save the .vhd file on an externally attached device. The process of creating the image is quite slow saving the image on the same drive it is from will just make it slower. Furthermore the installation you are creating the image from is probably not a clean one.The image will be built with various applications and configurations from your running installation and will cause the size of the image to grow a bit. If your drive is VFAT formatted then your image file can be no more than 4gigs. Ensure that the file system will accept larger files or your vhd file has to be less than 4gigs. With all that said, lets dig in.

Getting and installing

Disk2vhd is a quite handy tool. There is no need for installation since it is just a  self-contained binary, which  can be executed from any location including your flash stick. So head over the Microsoft Technet site and download and extract the file using your favorite extracting tool, you will now have three files inside the newly created Disk2vdh directory. You can double clik on disk2vhd to launch the tool. Once it is running, you will see the main window (Figure A). You do not have to configure it, all you have to do is select your parameters as defined on the main window – so simple, huh!

Figure A

As shown above, my configuration is set to have the target file on an external  I have set the location of my target file to be on an external hard drive. This ensures hat I have enough space and my computers performance is not compromised by the entire process. Now all you have to do is clik on Create. You have to be patient since the process might take some time depending on the size of your installation. Once the process has begun you will see the progress bar moving quite slowly.  (Figure B).

Figure B

On cliking Create, the process begins by snapshotting your volumes then copying

Once the process is complete, you will have a file on your target drive named after your PC with the extension .vhd. This is the file that you can then import into the virtual machine application of your choice. Without much details on the workings of each virtual machine tool, the process of adding these image files is even simpler:

  • Create a new virtual machine with the characteristics that match the machine used to create the image file.
  • During the process of creating the virtual machine, use the vhd file as the new machine’s IDE disk.
  • When you first boot the new machine, the virtual machine tool will detect the machine’s hardware and automatically install the drivers.

The steps above is variant on the virtual machine tool you use.

Food for thought

Working as an administrator often entails use of virtual machines for reasons highlighted in this tutorial. It is therefore good practice to take advantage of Disk2vhd to create virtual images designed to your specifications.

Share

SNETTSCOM is an IT company. We excel at providing solutions in systems integration, consultancy, outsourcing, applications development, networking and security. Aside from this, SNETTSCOM also specializes in creative design and marketing.

Recommended Posts