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.
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.
If VHDX format:
Write one partition:
Mount partition:
Unmount and disconnect image file:
There are at least two similar questions that got accepted answers:
https://superuser.com/questions/40294/copying-a-vhd-to-a-physical-disk
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.Use HDDGuru Raw Copy Tool
This can be used for any of the mountable formats on Windows, iso, vhd, vhdx etc.
It is possible to use Virtualbox to attach a physical device as a virtual device inside the VM
Windows method
Linux method
Using an additional iso as live CD something like hirens boot or some linux rescue image, it is also possible to do image copying from one virtual device to a physical device that is virtually present inside the virtual machine.
qemu-img command which is part of the QEMU emulator package supports VHD. 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?).
To restore image.vhd to /dev/sda, run:
I have used vmdk2phys to successfully accomplish this.
There's another tool called Disk Image Tools or DITOOLS, which purports to do the same.
As others have stated, acronis true image can do this. Western Digital has a version of acronis true image that works on any computer with at least one WD hard drive installed called Acronis True Image WD Edition, however I am unsure if it supports Virtual Machine Hard Disk Images such as VHD/VMDK.
Another option is to mount the vhd in the Disk Management MMC, and then use a tool such as Roadkil RawCopy.
There is a program called VHD2disk that will do this but as earlier posts mentioned it needs to be run from within windows. I have successfully used HIRENS PE10 which boots a windows 10 environment off flash drive or DVD. I have also successfully cloned and imaged using this approach.
The VHD2disk utility unlike DISk2VHD is not produced by sysinternals, but still works well. (BTW I was having trouble finding it on Google last I just checked - that is how I ended up here)
I once achieved this using a rather long way. Created a Hyper-v vm using existing vhd file and when it booted up ran a Windows Image Backup to create a bootable Image and copied the output folder to an external USB hdd. Then on target computer plugin the external usb Hdd, but boot from an ISO on DVD or Stick and choose "Restore from image" and point to the image folder location on the external USB hdd. The image will be restored.
Not aware of a free way but I know one of Acronis's products ('True Image'?) can do this.
Convert the disk using the plethora of vhd to vmdk convertors, such as this one: https://sourceforge.net/projects/vboxhdtools/
Then use this tool to convert to a physical drive (in windows): https://sourceforge.net/projects/vmdk2phys/