Page 1 of 1

Convert Virtualbox image: VMDK to RAW

Posted: Fri Dec 04, 2015 2:38 am
by peter_b
1) Quick-quick command list for converting a VMDK image file to RAW and then compressing it:

Code: Select all

$ qemu-img convert input.vmdk -O raw output.img
$ pigz -9 output.img
Using pigz instead of gzip, because it's multithreading (=faster)

2) Restore image to physical disk:

Code: Select all

$ pigz -dc output.img.gz | pv | dd of=/dev/sdX bs=4096
pigz arguments:
  • -d: decompress
  • -c output to stdout (to allow piping)
Make sure you have "pigz" (parallel gzip) and "pv" installed for it to work.
The command "pv" is optional, to show the transfer progress (MB/s).
If you don't have "pv", just remove it ;)

Re: Convert Virtualbox image: RAW to VMDK

Posted: Wed Jun 08, 2016 5:20 pm
by peter_b
Here's the other way around:

Code: Select all

$ qemu-img convert -O vmdk imagefile.img imagefile.vmdk
This works well with a "dd" image from e.g. a USB stick.

Thanks to post by user "antonio" at superuser.com :)