Viktor Petersson logo

Blog

How to migrate from qcow2/raw to iSCSI with KVM/QEMU

29 JUL • 2016 1 minute

I recently had to migrate a number of VMs currently running on an NFS share to an iSCSI target. During my research, I was surprised how little documentation there was around this, so I decided to whip up this quick little piece about how to do it.

Here are the steps:

  • Create a new iSCSI target (one per VM/image you’re migrating). This step varies depending on your setup.
  • Attach target on server (I found virt-manager suitable for the task).
  • Find the device from logs (/dev/sdc below). On Ubuntu, you will also need to install the package open-iscsi.
  • Run qemu-img convert /path/to/your/image.qcow2 -O raw /dev/sdc (for raw images, you could simply use dd but to keep things consistent, I opted for qemu-img).
  • Update the disk config in the VM definition to point to the iSCSI target.
  • Boot the VM and archive the old disk image.

Voila! You should now have a VM running on iSCSI and you will likely receive better I/O performance.

Found an error or typo? File PR against this file.