Copying a VHD to a physical disk

I use the Windows only freeware tool HDD Raw Copy Tool to write .vhd images to physical media.

HDD Raw Copy Tool Screenshot

My use case is using Windows 7 to replicate FAT32 partitions onto micro SD cards but it can support a wide range of interfaces/media types.

It has a portable version available for one-off or nomadic use, or an installer if you prefer that kind of thing.

The GUI is quite straightforward:

  1. Select source (drive or file)
  2. Select destination (drive or file)
  3. Copy

The dd approach works, but only if the destination physical disk can be trashed and entirely overwritten, and is at least as big as the maximum growth size of the virtual disk. This can also end up taking a long time if the virtual disk isn't "full".

An alternative approach is to use an imaging tool like Ghost or ImageX to efficiently capture the file contents of the virtual disk's partitions into some sort of extractable archive files and then extract their contents onto a partitioned physical disk.


The following operations are performed on knoppix (live linux) from terminal.

  su 
  modprobe nbd
  qemu-nbd -r -c /dev/nbd0 -f vpc <vhd_file_name>

if VHDX fromat

  qemu-nbd -c /dev/nbd0 -f VHDX <vhdx_file_name>
  ddrescue -v -f /dev/nbd0 /dev/sda  >>>> image to /dev/sda writing

only one partition writing

  qemu-nbd -P 2 -r -c /dev/nbd2 -f vpc <vhd_file_name> 
  ddrescue -v -f /dev/nbd2 /dev/sda2 >>>> part2 of image to /dev/sda2 writing

partition mount

  qemu-nbd -P 2 -r -c /dev/nbd2 -f vpc <vhd_file_name> >>> -P 2 part2 of image 
  mount /dev/nbd2 /mnt 

unmount and disconnect image file

  unmount /mnt 
  qemu-nbd -d /dev/nbd2