Thursday, October 2, 2008

V2P (Virtual-to-Physical) for VirtualBox

So you might have had a great Virtual Machine which has your development environment or may be a specific build environment. You think the time has come now to free this VM and give its own dedicated hardware. Or even none of the above is true, you want to do it because you can :)

You will have to go do what is called as v2p (Virtual to Physical) migration. So lets just think about what exactly we are trying to do. We have Virtual Machine running inside a VirtualBox which has its own virtual hard disk. The converting a virtual machine to a physical machine is mainly about changing this virtual machine operating system boot from a physical real hard disk than virtual hard disk on which it was running when inside VirtualBox.

VirtualBox comes with one hidden command under its hood, convettoraw! This can be used in following manner,

VBoxMange internalcommands converttoraw your.vdi your.raw

So now you have a raw image of your VM (pleaes note that if you have a VM of say, 16GB dynamically expandable virtual hard disk, when you create a raw image it will actually create a file which will occupy 16GB on your disk! so make sure you have that much of space on your disk before procedeeing). Now this raw image can be deployed to another disk very easily.

Connect the disk on which you want to deploy the raw image that you just created to your existing system. Now depending upon on the Operating system that you are running the actual command may very. I will pick Linux as my host operating system on which I will assume the VirtaulBox is running. So this second physical disk appears as /dev/sdb on my Linux box, so I execute,

dd if=/location-of-your-raw of=/dev/sdb

Once its done, connect this disk as primary master to the system that you are planning run. At first boot, make sure the system is started with -r option to re-configure the devices.


edgar said...

Two questions:

1. The row image (dd) obtained can be deployed on partition instead of entire disk?

2. What about windows xp? Do I need some extra things go get running?


Alex said...

I need to do a V to P with the Sunbox having the XP Image I have built with Sysprep and Driver packs. I need to change it from a VDI sunbox to work with a physical machine. Anyone have a walk through or how to do this

Sun Virtutalbox (windows XP and Window 7 build machines, working great)

I have already set them to install drivers on 1st boot and they will sysprep on 1st boot. This works great p to p but I want to build the images on the VBox and move it to a phsyical computer. (I can already boot into a BartPe /Live Cd with ghost to ghost over the image, but it will crash on me.

Need help anyone?

Can Atuf Kansu said...

Can you give the command for Windows OS also to install the virtual harddrive image to the physical one ?