Disk Imaging and File Backup for Windows 7, Vista, XP and Server 2003/2008 RSS 2.0
# Tuesday, March 16, 2010

How to create a Virtual machine from a Macrium image backup

ImgToVhd is a utility that creates VHD files from Macrium backup images. These can then be used to create a bootable virtual machine facilitating quick access to a failed machine whose repair would be time consuming or not possible.


We have created a utility, ImgToVHD to enable the conversion of a Macrium backup image file to VHD files (one per disk). The VHD file(s) can then be used as the storage component of virtual machines from Microsoft (Virtual PC and HyperV), VMWare and Oracle/Sun (Virtual Box).

This enables a previously backed up machine to be reincarnated as a virtual machine. A significant use of this is to quickly regain access to a machine that has suffered a fatal hardware failure.

Please note that this is beta quality software. It is being released to the public for evaluation purposes only. No guarantees are made for its quality or fitness for purpose. Use is not recommended in a production environment.

Feedback is welcomed as this will help us improve the quality and utility of this tool and this blog post. Comments are currently enabled for this post - constructive comments will be helpful to both us and the other users of this tool.

Please take care to ensure that you are not breaking the terms on any licences by running a virtual machine from a backup image.


Get ImgTOVHD

You can download ImgToVHD from here.

Invoke the downloaded msi as per any other installer.


ImgTOVHD Usage

ImgToVHD offers both a GUI and a command line interface.

If you wish to use the command line interface, ImgToVHD --help will emit some instructions.

The ImgToVHD user interface is straight forward.

Firstly, you will need an Macrium image file - a file and folder backup file will not work here. If you wish to create a bootable VM from scratch, and not just add a disk to an already bootable VM, then the image will need to contain an image of both the active and the windows system partition. Typically the system partition is also the active partition.

You will need enough spare disk space to store the resulting VHD file. If you have selected all the partitions from the source image and the image is compressed, then the resulting VHD file size is likely to be rather larger than the source image as VHD files don't support compression and have a larger sparse granularity than the image files. Calculate the sum of the used space of the selected partitions and ensure that you have slightly more free space than this for the VHD file.

Once you have selected a source image, a list of disks will be presented to you. Select from this, the one in which you will to convert to VHD and then you will be presented with a list of partitions. Select as many of these as you require.

There are three options that are best left unselected unless you understand the consequences.

  1. Remap partition table. In the case where not all the partitions are selected or backed up in the first case, this option only include those selected partitions in the partition table. This doesn't effect extended (logical) partitions. If you don't remap, partitions not included in the VHD creation or the original backup will appear as RAW in the disk management console. Remapping can prevent Windows XP from booting.

  2. Reset disk ID. This will definitely result in a non-bootable VHD. It is useful only if mounting the VHD on the machine containing the original disk.

  3. Continue on errors. If there are errors in the source image, and this is checked then the VHD creation process will continue. However, the resultant VHD file is guaranteed to have missing data. Dependent on the location of the errors, the image might or might not be usable.
Once the disk, partitions and options have been selected, hit convert. The conversion process will probably take a significant period of time due to the large volumes of data handled. Now would be a good time to consider a hot beverage of your choice.

There are a number of caveats to be aware of. Of particular significance is the fact that the VM is likely to represent a significantly changed hardware environment from the original machine.

  1. Windows OEM licensed installs, typical for retail machines delivered with the operating system preinstalled, do not allow a change in the motherboard.

  2. The HAL and mass storage drivers might not match the those presented in the virtual environment. This may prevent Windows from booting. See here for further details on how to reconfigure Windows XP. Virtual Box enables some flexibility in the hardware environment so it can be made to match the original hardware.

  3. Don't mount/attach this image on the original machine if you plan on booting from it as Windows will detect the duplicate disk ID and will change it, invalidating the BCD disk references.

  4. The vhd file size must be limited to 127GB if you wish to use it with Virtual PC.

  5. If the vhd is being created on a FAT32 filesystem, the creation process will fail if the created file size is greater than 4GB. This is a due to a limitation of FAT32; though the vhd specification supports splitting across multiple files, ImgToVHD doesn't currently support this feature.

Using the vhd with Virtual Box

Virtual box comes in two flavours, an open source edition (missing RDP and USB support) and a commercial version that is free for evaluation or personal use.

Configuration is quite straightforward. Note the following instructions refer to version 3.14.

From the main window, hit new to create a new VM which will launch a wizard.

Select the OS to match the OS to be virtualised as below.



The next wizard page (not shown for brevity) allows you to specify base memory. Chose a value that matches what is required for your virtualised OS, bearing in mind that there must be enough memory available on your host machine.

To specify the vhd you have created with ImgToVHD as a hard disk, you first have to add it to Virtual Box using the Virtual media manager by clicking on the yellow folder icon.



Click the Add button and select your vhd file, the hit select. Repeat this process for each vhd file you have created.



All being well, you should now have a working VM. Hit the start button and your old machine should now appear in a window on your host.



If it fails to boot, then you might have a kernel/Hal/Mass storage driver miss-match issue.

VirtualBox enables various hardware environment options to be configured. Hit the settings button to edit your VM. Select the system item on the left. Things to try are enabling the IO APIC (motherboard tab) and 1/multiple CPU's and disabling PAE/NX features (processor tab). Also, consider reconfiguring the vhd as a SATA device if that's how the original machine was configured.




Using the vhd with Hyper-V

Hyper-V is a hypervisor based virtualisation system. It only runs on x64 Windows Server 2008 and requires hardware assisted cpu features.

To create a VM, select 'New Virtual Machine from the Hyper-V Manager. Chose location, name and base memory size the new Virtual Machine Wizard.

When you get to the connect Virtual Hard Disk page, select 'Use existing virtual hard disk' and chose your previously converted vhd file.



Complete the wizard and start the VM. All being well, the VM will boot. Unlike Virtual Box, there is no flexibility to change the virtual hardware options - if it doesn't boot, the OS booting options / HAL etc will need to be reconfigured.

Note: If an error regarding incompatible sector size is raised, it does not refer to the VHD file as indicated, but the disk upon which the vhd is stored.





Using the vhd with Virtual PC

The process is similar to the hyper V configuration again specifying the generated vhd file an existing disk.

The only caveat is the 127GB disk size limitation, as previously noted.

Note that you must use imgToVhd v1.0.2597 or later.


Using the vhd with VMWare Server

VMWare Server lacks the flexibility to use vhd files as a virtual disk file and you are required to use vmware's own vmdk file format. Unfortunately, VMWareConverter will only convert complete vm configurations not individual virtual disk files.

The starwind V2V converter has been found to work well and is available cost free from here...
http://www.starwindsoftware.com/converter

Once you have a vmdk file, the process of generating a virtual machine is similar to that discussed above. Note, be careful to chose the correct hardware connection for the vmdk i.e. ide or scsi. The correct choice will depend on source machine configuration.


Conclusion

We hope you find this tool and blog post useful.

The intention is for this blog to grow. Specifically, expect instructions for use with VMWare and Virtual PC to follow.



ImgToVHD history

v1.0.2544 - First beta release.
v1.0.2586 - Correct XP partition alignment problem.
v1.0.2597 - Improve Virtual PC 2007 compatibility




John Pendleton  Tuesday, March 16, 2010 2:10:57 PM (GMT Standard Time, UTC+00:00)  #    Comments [6] -
Knowledge Base | Tutorials
Sunday, March 21, 2010 3:31:41 PM (GMT Standard Time, UTC+00:00)
Hi,

Just a quick thank you for the software. ImgtoVHD worked perfectly and I had a virtual XP machine up and running in minutes. Could not believe how easy the operation was.

Thank you again.

Regards,

David B.
David Blackstone
Wednesday, March 31, 2010 10:58:29 PM (GMT Standard Time, UTC+00:00)
Hi,

Any plan for a similar product on VMware?

Ted
Thursday, April 01, 2010 7:17:24 AM (GMT Standard Time, UTC+00:00)
Ted,

VMWare should work just fine with vhd files. If it transpires that there are issues, then support will be added for vmdk files (the VMWare native disk image format).

I hope this helps.

Kind Regards
John - Macrium Support
John Pendleton
Wednesday, May 12, 2010 5:02:42 PM (GMT Standard Time, UTC+00:00)
John:

The imaging software works very nicely but I could not successfully create a W2K3 Standard vm after converting the image with V1.0.2597. I am using the free version of VMware V2.0 and received a "bad VHD" error message when I attempted to use it to create a new vm. How are you progressing in your efforts to convert to vmdk "drives"? Thanks.

Aloha,
Miles
Wednesday, May 12, 2010 5:25:56 PM (GMT Standard Time, UTC+00:00)
Miles,

Thanks very much for your feedback. We will definitely look into that issue and get back to you asap. As all the common Virtual Machines accept vhd files - we had not yet committed to vmdk format support.

Could you send an email to support at macrium.com in case I need to contact you for more details and to give you timely information of an available fix.

Kind Regards
John - Macrium Support
John Pendleton
Friday, May 14, 2010 12:04:46 PM (GMT Standard Time, UTC+00:00)
Miles,

It seems that VMWare server does not support vhd files. I have appended the blog with some guidance on configuring vhd files with a VMWare VM.

I hope this helps.

Kind regards,
John - Macrium Support
John Pendleton
All comments require the approval of the site owner before being displayed.
Name
E-mail
Home page

Comment (Some html is allowed: a@href@title, b, blockquote@cite, em, i, strike, strong, sub, sup, u) where the @ means "attribute." For example, you can use <a href="" title=""> or <blockquote cite="Scott">.  

Enter the code shown (prevents robots):

Live Comment Preview
Categories
Archive
<July 2010>
SunMonTueWedThuFriSat
27282930123
45678910
11121314151617
18192021222324
25262728293031
1234567
Sign In
© Copyright 2010
Paramount Software UK Ltd
Sign In
Statistics
Total Posts: 32
This Year: 6
This Month: 0
This Week: 0
Comments: 150
All Content © 2010, Paramount Software UK Ltd
DasBlog theme 'Business' created by Christoph De Baene (delarou)