Using dd command, it possible to create image of type .vdi, .qcow, .qcow2, .vhd, .vhdx and .vmdk instead of .img?
dd if=/dev/hda of=/path/to/desti.**qcow2 or .vhmdk** etc formats
Thank you, Answers Appreciated
You may first create a raw image via dd
, and then convert to any supported format via qemu-img
e.g.:
dd if=/dev/hda of=/path/to/dir/hda.raw
qemu-img convert -O qcow2 /path/to/dir/hda.raw /path/to/dir/hda.qcow2
Or to save disk space omit the dd part: qemu-img
can read directly from disk:
qemu-img convert -O qcow2 /dev/hda /path/to/dir/hda.qcow2
In both cases a virtual disk in qcow2 format is created. To see a list of supported formats and options, see man qemu-img
. Maybe you have to execute the commands prefixed by sudo
to get access to /dev/hda
.
No you cannot, with one exception.
dd
is a very simple program which simply copies bytes from an input file to an output file, optionally making simple transformations such as swapping bytes, mapping upper-case ASCII letters to lower-case or vice-versa, or transcoding between ASCII and EBCDIC. It has absolutely no notion of a file format; for dd
a file is simply a sequence of bytes. Use man dd
for more info.
There is a kind of VMware virtual disk which is called "flat" (specifically, monolithicFlat
and twoGbMaxExtentFlat
). "Flat" VMware virtual disks actually are direct block-for-block images of a hard disk; they consist of at least two files: a description file (a text file with the extension .vmdk
) and one or more data files. You can use dd
to copy the data from a hard disk to a data file, create a suitable description file (easy to do) and use that data file (possibly split into several extents, if you wish) as a "flat" VMware virtual disk. As far as I know, you can use such virtual disks with VirtualBox too.
man dd
and see if it says something about output formats. However, I think you can specify the output format manually, no matter what it is, try for example, using a different extension for the output file, and then do the reverse process to see if the image works. Best regards. – GTRONICK Nov 24 '16 at 14:52