hypervisor: 0.956 risc-v: 0.947 virtual: 0.934 device: 0.917 vnc: 0.861 performance: 0.815 ppc: 0.803 PID: 0.760 files: 0.751 kernel: 0.747 architecture: 0.746 VMM: 0.745 register: 0.738 network: 0.724 graphic: 0.711 socket: 0.666 boot: 0.615 debug: 0.588 i386: 0.574 assembly: 0.573 arm: 0.555 peripherals: 0.555 x86: 0.528 KVM: 0.527 semantic: 0.518 permissions: 0.516 user-level: 0.487 TCG: 0.455 mistranslation: 0.273 qemu-img cannot repair a qcow2 in an LV because size is mis-detected when qcow2 is on an LV Description of problem: This is RHEV with Tb's of VMs which need to be repaired due to a datacenter-wide (the real datacenter) power outage. Each of these VMs are on individual LVs but qemu-img check fails to perform repairs: ``` ERROR cluster 24481205 refcount=0 reference=1 ERROR cluster 24481206 refcount=0 reference=1 Rebuilding refcount structure ERROR writing refblock: No space left on device <============ qemu-img: Check failed: No space left on device ``` Running qemu-img check or info on the LV (/dev/dm-*) works well but repairs cannot be completed: ``` # qemu-img info /dev/cdd4e215-8c6b-4877-b2be-fdba383e7eb0/fb32333b-2334-4e10-8c42-02bc97e826cc image: /dev/cdd4e215-8c6b-4877-b2be-fdba383e7eb0/fb32333b-2334-4e10-8c42-02bc97e826cc file format: qcow2 virtual size: 1.5 TiB (1649267441664 bytes) disk size: 0 B <================================ cluster_size: 65536 Format specific information: compat: 1.1 compression type: zlib lazy refcounts: true refcount bits: 16 corrupt: false extended l2: false ``` Steps to reproduce: 1. Have a damaged VM with its qcow2 in an LV 2. run 'qemu-img check ' verify that it properly detects the blocks which need fixing. 3. run 'qemu-img check -r all ', it exits with 'no space left on device“ after a few seconds. Additional information: https://bugzilla.redhat.com/show_bug.cgi?id=1519071 Here is one example: