Convert a raw dd image to VMDK (vmware)

vmware

This site is run on my very own web server. I keep backups (of course) with the help of the magic tools rsync and tar. But I also like to make an image of the operating system disc with the help of dd. When dd is done creating the raw image file I sometimes like to create a test system, a replica of the production environment. It’s fun to be able to play around knowing you can’t destroy anything, because if you do you just start over. I use vmware  for my playground test system.

To easily convert a dd raw image to a vmware vmdk hard disk file you first must install qemu:

sudo apt-get install qemu

With qemu you can do a lot of things and convert from many file formats, but in this post we’ll only show how to convert to vmdk, but you should really have a look round the qemu help for more information. 

Now how to convert:

qemu-img convert -pO vmdk /path/disk.raw /path/hard_disk.vmdk

The commands:

-p Progress. Not necessary but its nice to see when the conversion will be done.
-O

Output format. We want the output file in this case to be a vmdk file.

Valid output formats: (copied from here)

vmdk VMware
raw (default) the raw format is a plain binary image of the disc image, and is very portable.
cloop Compressed Loop format, mainly used for reading Knoppix and similar live CD image formats
cow copy-on-write format, supported for historical reasons only
qcow the old QEMU copy-on-write format, supported for historical reasons
qcow2 QEMU copy-on-write format with a range of special features, including the ability to take multiple snapshots, smaller images on filesystems that don’t support sparse files, optional AES encryption, and optional zlib compression
vdl VirtualBox
vhdx Hyper-V compatible image format, for exchanging images with Hyper-V 2012 or later.
vpc Hyper-V legacy image format, for exchanging images with Hyper-V 2008 / Virtual PC.

 

That’s it. You now have a new hard disk drive ready to be used by vmware

Cheers
/jima

Leave a Reply

Your email address will not be published. Required fields are marked *