Skip to content

Instantly share code, notes, and snippets.

@riblo
Last active November 19, 2019 16:59
Show Gist options
  • Save riblo/3001369c81739f31af856a612e9de01a to your computer and use it in GitHub Desktop.
Save riblo/3001369c81739f31af856a612e9de01a to your computer and use it in GitHub Desktop.
Proxmox/KVM images conversions
# qcow2 -> qcow2compress
qemu-img convert -O qcow2 -c vm-103-disk-0.qcow2 vm-103-disk-0-comp.qcow2
# lvm-thin -> qcow2
qemu-img convert -O qcow2 /dev/lvm-thin/vm-103-disk-1 vm-103-disk-1.qcow2
# lvm-thin -> qcow2compress oneline
qemu-img convert -O qcow2 -c $(pvesm path lvm-thin:vm-103-disk-1) vm-103-disk-1.qcow2
# qcow2 -> raw
qemu-img convert -f qcow2 -O raw vm-103-disk-0.qcow2 vm-103-disk-0.raw
# raw -> ceph RBD storage
rbd --image-format 2 import vm-103-disk-0.raw cephrbd/vm-103-disk-0
# raw/qcow2 -> local-lvm storage
qm importdisk 201 vm-201-disk-0.raw local-lvm
# ceph RBD -> raw
rbd export cephrbd/vm-100-disk-0 /tmp/vm-100-disk-0.raw
# raw -> local-lvm
qm importdisk 100 /tmp/vm-100-disk-0.raw local-lvm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment