Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

It's quite easy to backup a real drive to VHD, e.g. with Sysinternal's Disk2VHD on XP or with Windows Image Backup on Windows 7. But how do I copy that file back?

It's possible by booting a recovery CD or the Windows installation DVD. But can it also be done from a running operation system? Can it be scripted?

We want to clone a drive to another drive daily using this.

share|improve this question
You just want to use the VHD as an exchange format? Without ever running it in a virtual machine? Then use imaging software like Clonezilla, Norton Ghost or Acronis True Image. – mailq Aug 2 '11 at 15:57
Microsoft chose VHD as it's image format for any kind of activity: They use it for backups and in Win 7 you can mount them directly. The question how to RESTORE a backup is surely okay! – Christian Aug 4 '11 at 6:35

There are at least two similar questions that got accepted answers:

Vdisk (vhd) to physical

But you can't do it from a running OS.

It would be a hard thing to script this. Following the Linux dd aproach one could say that everything is possible. Boot from PXE, locate the VHD, locate the physical disc, dd from V to P, when finished reboot.

share|improve this answer… – Vouze Aug 11 '15 at 16:50

You can use qemu-nbd in Linux to access a disk image as if it were a block device.

Here are some examples of operations that can be performed from a live Knoppix terminal.

  modprobe nbd
  qemu-nbd --read-only --connect=/dev/nbd0 --format=vpc <vhd_file_name>

If VHDX format:

  qemu-nbd --connect=/dev/nbd0 --format=VHDX <vhdx_file_name>
  ddrescue --verbose --force /dev/nbd0 /dev/sda  # write image to /dev/sda

Write one partition:

  qemu-nbd --partition=2 --read-only --connect=/dev/nbd2 --format=vpc <vhd_file_name> 
  ddrescue --verbose --force /dev/nbd2 /dev/sda2 # write partition 2 of image to /dev/sda2

Mount partition:

  qemu-nbd --partition=2 --read-only --connect=/dev/nbd2 --format=vpc <vhd_file_name>
  mount /dev/nbd2 /mnt 

Unmount and disconnect image file:

  unmount /mnt 
  qemu-nbd --disconnect /dev/nbd2
share|improve this answer

It is possible to use Virtualbox to attach phisical device as virtual device inside the VM

win method

VBoxManage internalcommands createrawvmdk -filename "C:\Users\vhudson\VirtualBox VMs\usb.vmdk" -rawdisk \\.\PhysicalDrive1

linux method

VBoxManage internalcommands createrawvmdk -filename usb.vmdk -rawdisk /deb/sdb

Adding also additional iso as live cd something like hirens boot or some linux rescue image. It is possible to do image copying from one virtual device to physical device that is virtually present inside the virtual machine.

share|improve this answer

Not aware of a free way but I know one of Acronis's products ('True Image'?) can do this.

share|improve this answer

qemu-img command which is part of the QEMU emulator package supports VHD according to its manual page (though I have never needed this myself). I do not know if this works on Windows but on Linux at least it does (I suppose it does not matter as you did not tag your desired platform?).

share|improve this answer

If you are running win vista, 7, 8... You can use bcdedit. Paste your vhd file on c: Generate a new sid for your new machine Give the path to the vhd Activate the os Reboot and you ll have a dual boot with your new system. You re goin to work directly on your vhd image

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.