Virtual to physical migration / copying / cloning issues

Discussions about using Windows guests in VirtualBox.
Post Reply
kilves76
Posts: 32
Joined: 28. Aug 2008, 19:33

Virtual to physical migration / copying / cloning issues

Post by kilves76 »

(googled and searched already with not much results)

I am just in the process of migrating a Windows 7 virtual machine to a physical. Using

vboxmanage internalcommands converttoraw win7.vdi win7.raw

to convert the image into a raw image, and then, hopefully, transfering it with

dd if=win7.raw of=\\.\physicalddrive1 bs=128M

Just couple of questions:

1. Is there a method to directly read the vdi image as a raw image, thus bypassing the vdi-raw conversion? I read about using ImDisk to mount it, but when I try that, the resulting drive is not recognized in the host Win Vista.

2. How to find out reliably which drive letter represents which \\.\physicaldrive ? Tried using cmd commands like DIR etc, but they do not take a UNC identifier like \\.\physicaldrive1 as parameter.

and of course 3. is there some easier/saner way of doing this? Is this even going to work with Win 7? Taking the disk image size into account, I have plenty of time for reading answers :)
kilves76
Posts: 32
Joined: 28. Aug 2008, 19:33

Re: Virtual to physical migration / copying / cloning issues

Post by kilves76 »

Darn, dd doesn't want to play:

T:\VBox\HardDisks>dd if=win7-1.raw of=\\.\physicaldrive1 bs=4M
rawwrite dd for windows version 0.5.
Written by John Newbigin <jn@it.swin.edu.au>
This program is covered by the GPL. See copying.txt for details
Error writing file: 5 Access is denied
1+0 records in
0+0 records out

Any other ideas how to write the raw image?

Tried with disk connected to both usb and esata, same result. Trying with unformatted drive letter also crashes dd.
kilves76
Posts: 32
Joined: 28. Aug 2008, 19:33

Re: Virtual to physical migration / copying / cloning issues

Post by kilves76 »

Problem solved, earlier attempt to write with dd with drive connected to usb failed, however not before the first buffer was written, and that creates the mbr for the disk. After that, windows locks something somewhere, that writing with dd will not succeed anymore. Removed all partitions from target disk with diskmgmt.msc and now dd operation went smooth. One power cycle for the drive and windows sees everything as normal.

Next step, trying bootability.
Post Reply