This question already has an answer here:

Is any way to copy file system from VirtualBox .vdi file (or others like that) to physical partition on a hard drive?

marked as duplicate by user364819, David Foerster, Eric Carvalho, Charles Green, Zanna Jun 10 '17 at 7:53

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


There is probably a utility to do this, but you can do it rather easily without any special software, which is always a useful trick to know, as it will work with any type of virtualization software.

Simply boot up a live image in the virtual machine with .vdi attached. Make sure networking is enabled and the machine with the target disk and guest can see each other. Then, dd the virtual partition and pipe to netcat on the guest, and receive it on the host system with netcat and write to the partition with dd.

On the target machine run:

netcat -l -p 4444 | dd of=/dev/<target partition or disk>

It will wait. Inside the guest run:

dd if=/dev/<source partition or disk> | netcat <target-machine-ip> 4444

This is assuming the source and target devices are exactly the same size, which they probably are not.

Note that the target machine does not have to be the virtualization host machine, it can be any machine that the guest machine can reach over the network.

For special software to manipulate .vdi images in a variety of ways see: Mount a VirtualBox drive image (vdi)?


You should copy the contents of the file system instead of writing an image to a physical disk in bitwise mode. This is especially recommended for SSDs with TRIM support, because when TRIM kicks in it will delete files that it doesn't know about (it just starts to clean blocks where it assumes that no files are stored, which is the case for everything that is written in bitwise mode to a SSD). Additionally, copying files to a new file system automatically defragments the files for you.

You can use cp or rsync with the -a parameter as root to preserve permissions and ownership.

At last you need to re-install the boot loader, to have a functional booting operating system. GRUB and GRUB2 can be re-installed via live CD with the --boot-directory option, Windows should provide similar functionality on its installation disk.


You can convert VDI file into RAW format, then use dd command to copy the image into partition.

For example:

VBoxManage clonehd --format RAW file.vdi file.img
dd if=./file.img of=/dev/<partition_here>

Note: Use sudo if required. Be careful when specifying the right device in /dev.


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