This project is read-only.

OSClone with physical disk?

May 4, 2010 at 8:32 AM


my goal is to make a VHD disk out of an existing physical disk.

So I played with the OSClone example, but I did not find a way to make a physical disk to the <input disk>.

I hope it is just my lack of experiance.

So my question: Is that possible with OSClone?

If not, can I simply dump the physical disk sector by sector to a VHD stream?




May 4, 2010 at 8:48 AM
Edited May 4, 2010 at 8:49 AM
Hey Jangoman, OSClone is just to clone from one VHD to another. So for your usecase not usable. The way to dump the disk sector by sector is possible but not very efficent as you copy unused space to the vhd, which will get as big as the disk is. Another way to do this is to use Volume Shadow Copy when you are on windows. Disk2VHD from Sysinternals does this. Then you have a copy of your disk but only with the size of the used size of the physical disk. Hope that helps. Ciao Ephraim
May 4, 2010 at 9:45 AM

Hi Ephraim,

many thanks for your answer. Yes, these unused sectors would have been filtered.

But the idea you gave me raises more questions, it is not clear how the workflow would be.


Create empty VHD.

Copy MBR to VHD (stream) - Do I need to partition it anyway, or is it defined via MBR? (Diskpart -rescan)

Make VSS Snapshot of physical HD partition.

Copy Bootsector of partition to VHD partition as stream.

Do a file copy (all) from VSS Snapshot to VHD partition.

Do the same next partition or finish.


Did I understand correctly?





May 4, 2010 at 9:57 AM
Edited May 4, 2010 at 9:58 AM
Hey Jangoman, yep, I meant it like you said, more or less. @MBR: I'm not sure but it might work when you embed the MBR and load then a BiosPartition instance from that stream ... Anyway, partitioning the disc with discutils is very easy. And formating will be needed anyway, can be done via discutils too. You'll need to copy the MBR, the VBR (Bootsector) and the NTLDR Section ( more Info about NTLDR Section => => The eight physical sectors directly following a Windows™ Vista NTFS Boot Sector, contain code which can interface with both the older NTLDR file (in order to boot up Windows™ NT, 2000, XP, 2003 OS partitions) plus code to interact with the new BOOTMGR (boot manager) program introduced with the Vista OS. This code is still necessary when booting up a Windows™ OS (even though the bootmgr or NTLDR files may not exist in the OS partition you start booting up from; as would be the case if, for example, you installed Windows™ Vista on a disk already containing a bootable Win 98 OS in the first partition followed by Vista's partition).) And then copy the files (and attributes and so on). As far as I understood your goal, you want to make the vhd bootable in a virtual machine, right? Then you will need to embed some drivers for the Harddisk Controller too. Which depends on the Virtualization Software you are going to target. Ciao Ephraim PS: Sorry for having no carrige return in the posts, but codeplex seems to ignore the carrige returns in my messages :(