Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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

share|improve this question
add comment

3 Answers 3

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.

share|improve this answer
add comment

http://superuser.com/questions/114445/is-it-possible-to-convert-virtual-machines-to-physical-environments I searched vdi to physical and this was the first of many existing posts on this issue. Remember Google first then ask.

share|improve this answer
add comment

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)?

share|improve this answer
add comment

Your Answer

 
discard

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.