Converting the QCOW2 image to a raw file format

Last Updated : Nov 26, 2024 |

Before you begin

  • Ensure that the Linux host has the qemu-img tool.

    Run the following command to install the qemu-utils package to get the qemu-img tool: sudo yum install qemu-utils

  • Ensure that the Linux host has enough disk space to hold the expanded RAW image. The RAW image is as large as the virtual size of the image.

    Run the following command to find the virtual size of RAW image: qemu-img info <asbce-image>.qcow2

    In the following example, the expanded RAW image is about 64GiB for this specific image.

    # qemu-img info sbce-10.2.1.0-101-24795.qcow2
    image: sbce-10.2.1.0-101-24795.qcow2
    file format: qcow2
    virtual size: 64 GiB (68719476736 bytes)
    disk size: 2.52 GiB
    cluster_size: 65536
    Format specific information:
        compat: 1.1
        lazy refcounts: false
        refcount bits: 16
        corrupt: false
    

Procedure

  1. Log on to the Linux server as a root user.
  2. Copy the QCOW2 image file to a temporary directory.
  3. Run the following command to convert the QCOW2 image to a raw file format: qemu-img convert image_name disk.raw
    For example:
    #qemu-img convert sbce-10.2.1.0-101-24795.qcow2 sbce-10.2.1.0-101-24795.raw
    # ls -lrt 
       -rw-r--r-- 1 root root 68719476736 Sep 25 15:04 sbce-10.2.1.0-101-24795.raw