Member-only story

Ceph: Moving Virtual Machine Image (Part III)

Moving between local disks and Ceph cluster

DaeGon Kim
2 min readApr 2, 2023

In this article we will take a look at moving storage between a local disk and Ceph block image for KVM virtual machine.

Let us set up a certain use case.

  • A virtual machine with a qcow2 image on local disk storage
  • A Ceph cluster with a rbd pool

We would like to move the local qcow2 image to the Ceph cluster and continue to use the VM. We will achieve this in two steps.

  1. Moving the image
  2. Updating the domain xml for the VM

If the VM is running, we need to shut it down before this process.

First we convert the qcow2 image to an image of the raw type. Then, we import the raw image into the Ceph cluster using the rbd import command. Please note that we uses this rbd command many times in the previous two articles.

sudo qemu-img convert -f qcow2 -O raw [img.qcow2] [img.raw]
sudo rbd import --dest-pool [pool] --dest [img] [img.raw]

The second step is updating domain xml for the VM. The figure below shows the snippets where the disk storage is defined in the both local and Ceph storage.

Domain xml change for storage switch from local to Ceph

--

--

No responses yet