[image-guide] improve chapter 'Converting between image formats'

* use latest version of CentOS for example filenames
* use latest version of Fedora for example filenames
* add an example for qemu-img how to directly convert from vmdk to qcow2
  to clearfiy that this is possible
* add VHD to the title of the qemu-img convert section
* add QED as supported format of qemu-img
* lists of supported qemu-img formats in alphabetical order
* add missing literal, filename and, command tags
* note that the default directory for Virtualbox VMs is ~/VirtualBox\
  VMs/ on Linux

Change-Id: Id9939c4d43652cb970b5b6a93d88772954788f18
This commit is contained in:
Christian Berendt 2015-01-20 17:49:49 +01:00
parent 398ef9fa12
commit 58e9421a7f

View File

@ -7,9 +7,9 @@
<title>Converting between image formats</title> <title>Converting between image formats</title>
<para>Converting images from one format to another is generally straightforward.</para> <para>Converting images from one format to another is generally straightforward.</para>
<simplesect> <simplesect>
<title>qemu-img convert: raw, qcow2, VDI, VMDK</title> <title>qemu-img convert: raw, qcow2, QED, VDI, VMDK, VHD</title>
<para>The <command>qemu-img convert</command> command can do conversion between multiple <para>The <command>qemu-img convert</command> command can do conversion between multiple
formats, including raw, qcow2, VDI (VirtualBox), VMDK (VMware) and VHD (Hyper-V).</para> formats, including qcow2, QED, raw, VDI (VirtualBox), VHD (Hyper-V), and VMDK (VMware).</para>
<table <table
rules="all"> rules="all">
<caption>qemu-img format strings</caption> <caption>qemu-img format strings</caption>
@ -22,37 +22,45 @@
</thead> </thead>
<tbody> <tbody>
<tr> <tr>
<td>raw</td> <td>qcow2 (KVM, Xen)</td>
<td><literal>raw</literal></td> <td><literal>qcow2</literal></td>
</tr> </tr>
<tr> <tr>
<td>qcow2</td> <td>QED (KVM)</td>
<td><literal>qcow2</literal></td> <td><literal>qed</literal></td>
</tr>
<tr>
<td>raw</td>
<td><literal>raw</literal></td>
</tr> </tr>
<tr> <tr>
<td>VDI (VirtualBox)</td> <td>VDI (VirtualBox)</td>
<td><literal>vdi</literal></td> <td><literal>vdi</literal></td>
</tr> </tr>
<tr>
<td>VMDK (VMware)</td>
<td><literal>vmdk</literal></td>
</tr>
<tr> <tr>
<td>VHD (Hyper-V)</td> <td>VHD (Hyper-V)</td>
<td><literal>vpc</literal></td> <td><literal>vpc</literal></td>
</tr> </tr>
<tr>
<td>VMDK (VMware)</td>
<td><literal>vmdk</literal></td>
</tr>
</tbody> </tbody>
</table> </table>
<para>This example will convert a raw image file named centos63.dsk to a qcow2 image file.</para> <para>This example will convert a raw image file named <filename>centos7.img</filename> to a qcow2 image file.</para>
<para> <para>
<screen><prompt>$</prompt> <userinput>qemu-img convert -f raw -O qcow2 centos64.dsk centos64.qcow2</userinput></screen> <screen><prompt>$</prompt> <userinput>qemu-img convert -f raw -O qcow2 centos7.img centos7.qcow2</userinput></screen>
</para>
<para>Run the following command to convert a VMDK image file to a raw image file.
<screen><prompt>$</prompt> <userinput>qemu-img convert -f vmdk -O raw centos7.vmdk centos7.img</userinput></screen>
</para>
<para>Run the following command to convert a VMDK image file to a qcow2 image file.
<screen><prompt>$</prompt> <userinput>qemu-img convert -f vmdk -O raw centos7.vmdk centos7.qcow2</userinput></screen>
</para> </para>
<para>To convert from vmdk to raw, you would do:
<screen><prompt>$</prompt> <userinput>qemu-img convert -f vmdk -O raw centos64.vmdk centos64.img</userinput></screen></para>
<para> <para>
<note> <note>
<para>The <literal>-f <replaceable>format</replaceable></literal> flag is optional. <para>The <literal>-f <replaceable>format</replaceable></literal> flag is optional.
If omitted, qemu-img will try to infer the image format.</para> If omitted, <command>qemu-img</command> will try to infer the image format.</para>
</note> </note>
</para> </para>
</simplesect> </simplesect>
@ -60,9 +68,9 @@
<title>VBoxManage: VDI (VirtualBox) to raw</title> <title>VBoxManage: VDI (VirtualBox) to raw</title>
<para>If you've created a VDI image using VirtualBox, you can convert it to raw format using <para>If you've created a VDI image using VirtualBox, you can convert it to raw format using
the <command>VBoxManage</command> command-line tool that ships with VirtualBox. On Mac the <command>VBoxManage</command> command-line tool that ships with VirtualBox. On Mac
OS X, VirtualBox stores images by default in the <filename>~/VirtualBox VMs/</filename> OS X, and Linux, VirtualBox stores images by default in the <filename>~/VirtualBox VMs/</filename>
directory. The following example creates a raw image in the current directory from a directory. The following example creates a raw image in the current directory from a
VirtualBox VDI VirtualBox VDI image.</para>
image.<screen><prompt>$</prompt> <userinput>VBoxManage clonehd ~/VirtualBox\ VMs/fedora18.vdi fedora18.img --format raw</userinput></screen></para> <screen><prompt>$</prompt> <userinput>VBoxManage clonehd ~/VirtualBox\ VMs/fedora21.vdi fedora21.img --format raw</userinput></screen>
</simplesect> </simplesect>
</chapter> </chapter>