Knowledgebase

How to create a Virtual machine from a Macrium image backup

Expand / Collapse
 

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.

Note:  The ImgToVhd tutorial was written before ReDeploy was developed.  If you have the Professional or Server editions of Macrium Reflect you can try the restore of an Image to a virtual machine as indicated at bottom of tutorial. This is an alternative to the ImgToVhd method.


Get ImgTOVHD

You can download ImgToVHD from here. if you are running v4.x of Macrium Reflect.

Invoke the downloaded msi as per any other installer. 

Note: ImgToVHD is already included with all editions of Macrium Reflect v5.0.
Take the 'Other Tasks' > 'Convert Image to VHD' menu option.


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.
  4. 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



Restore Image to Virtual Machine

This section is an alternative to the above ImgToVhd method.  To restore an Image to a Virtual Machine (VM) you will need either the Professional or Server editions of Macrium Reflect as you will need to use ReDeploy. Use the following steps to create a VM and restore an Image:
  1. Create a VM of suitable size to receive your Image.
  2. Boot your VM with a Windows PE rescue CD created with either the Professional or Server editions of Macrium Reflect. To do this make sure the boot order for the VM has CD first and before the VM's hard drive, also make sure the VM's accessible devices includes the CD drive.
  3. Using the Windows PE rescue CD restore your Image to the VM.
  4. Without rebooting run ReDeploy.
  5. Remove the rescue CD and reboot the VM using the VM's hard drive.

The VM should now boot with the restored operating system.

There are some links below on using ReDeploy and other tutorials, note that some of these tutorials were written for use on a normal computer and not on a VM but will show the method.

You can use the Professional edition of Macrium Reflect to restore Images containing Windows XP, Vista, 7, 8 and WHS whilst the Server edition can do the same as the Professional edition but in addition can also restore Images containing Windows Servers 2003, 2008, 2011 and 2012.

Details
Last Modified:22 Jul 2013

Last Modified By: evan.tringham@macrium.com

Type: Tutorial

Article not rated yet.

Article has been viewed 28,923 times.

Options