Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

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

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

  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
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.