Import virtualbox vhd to hyper v

I've been trying to import a VHD file created on VirtualBox to Hyper V, with no luck. Details:

VirtualBox version 4.3, running on Mac OS X Mavericks

Hyper V version 6.2.92, running on Windows 8

Created a CentOS 7 image, by installing from the CentOS 7 minimal install. When I created the VirtualBox VM, I selected VHD for the disk format. I selected automated partition configuration.

To export the VHD, I cloned the VirtualBox VM, and copied the cloned VHD to the Windows machine.

When loading on Hyper V, when the Linux VM boots, it goes into emergency mode, complaining that it can't find various directories/partitions, such as swap.

Any idea what's going on, or what I can try?

1

4 Answers

When you clone a vm under virtualbox it generates a new uuid for the virtual hard disk. you can use the "vboxmanage showhdinfo" command to see what the original vhd uuid was and what the new vhd uuid is. Armed with this you will have to edit your bootloader (usually grub for linux) to replace the old vhd uuid with the new (cloned) vhd uuid OR edit grub to boot using the name of the vhd -either way you will probably have to boot using a rescue cd in the virtual machine

The fact that the VM actually booted and goes into emergency mode means the disk formats are basically compatible.

Your problem isn't compatibility of the VHD; instead, you are having problems with differences in the emulated virtual hardware. It is likely that something about the disk device names changed and you need to go in with a rescuecd image and fix your /etc/fstab or something.

3

You can try and clone the VDI file to VHD file instead of directly exporting the VHD file. Have your tried cloning the HDD using the vboxmanage command?

vboxmanage clonehd D:\VMachines\CentOS.vdi D:\VMachines\CentOS.vhd –format VHD

Also when setting up the disk controller for Hyper-V choose IDE as the preferred format and it should work.

1

There is an easier way to copy the vdi/vhd image & keep the same uuid number:

After you have made a copy of the Hard Disk file using the Virtual Media Manager, select the original virtual disk & click on the Information tab below & copy the uuid number. go into command prompt & change your directory path to your virtualbox folder e.g: cd "c:\Program Files\Oracle" then type: VBoxManage internalcommands sethduuid {path to you virtual image file} {paste your uuid here}. here is an example command from my setup: VBoxManage internalcommands sethduuid G:\Centos\Centos-disk1_copy.vhd {f46a35d1-1c3f-44ac-bee1-8dac7d72db1d}

You will the get a prompt similar to this: UUID changed to: f46a35d1-1c3f-44ac-bee1-8dac7d72db1d

You can now use that VHD image on hyper-v

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like