Convert Virtualbox image: VMDK to RAW

Step-by-Step descriptions of how to do things.
Post Reply
User avatar
peter_b
Chatterbox
Posts: 371
Joined: Tue Nov 12, 2013 2:05 am

Convert Virtualbox image: VMDK to RAW

Post 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 ;)
User avatar
peter_b
Chatterbox
Posts: 371
Joined: Tue Nov 12, 2013 2:05 am

Re: Convert Virtualbox image: RAW to VMDK

Post 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 :)
Post Reply