How to fix a corrupt qcow image.

Dave Siddons

New Member
Mar 27, 2019
7
0
1
58
We have a VM that has developed a corrupt qcow image and will no longer start. First think noticed in host logs was this.

Jan 22 17:16:07 dc1-pc-tac84 kernel: [4844360.903755] kvm[13033]: segfault at 108 ip 000055c7b8832009 sp 00007ef33f499c20 error 4 in qemu-system-x86_64[55c7b820a000+91d000]
Jan 22 17:16:08 dc1-pc-tac84 kernel: [4844362.388754] fwbr183i1: port 1(tap183i1) entered disabled state
Jan 22 17:16:08 dc1-pc-tac84 kernel: [4844362.389154] fwbr183i1: port 1(tap183i1) entered disabled state
Jan 22 17:16:09 dc1-pc-tac84 qmeventd[2605]: Starting cleanup for 183
Jan 22 17:16:09 dc1-pc-tac84 ovs-vsctl: ovs|00001|vsctl|INFO|Called as /usr/bin/ovs-vsctl del-port fwln183o1
Jan 22 17:16:09 dc1-pc-tac84 kernel: [4844363.104210] fwbr183i1: port 2(fwln183o1) entered disabled state
Jan 22 17:16:09 dc1-pc-tac84 kernel: [4844363.104692] device fwln183o1 left promiscuous mode
Jan 22 17:16:09 dc1-pc-tac84 kernel: [4844363.104701] fwbr183i1: port 2(fwln183o1) entered disabled state
Jan 22 17:16:09 dc1-pc-tac84 ovs-vsctl: ovs|00001|vsctl|INFO|Called as /usr/bin/ovs-vsctl del-port fwln183i1
Jan 22 17:16:09 dc1-pc-tac84 ovs-vsctl: ovs|00002|db_ctl_base|ERR|no port named fwln183i1
Jan 22 17:16:09 dc1-pc-tac84 ovs-vsctl: ovs|00001|vsctl|INFO|Called as /usr/bin/ovs-vsctl del-port tap183i1
Jan 22 17:16:09 dc1-pc-tac84 ovs-vsctl: ovs|00002|db_ctl_base|ERR|no port named tap183i1
Jan 22 17:16:09 dc1-pc-tac84 ovs-vsctl: ovs|00001|vsctl|INFO|Called as /usr/bin/ovs-vsctl del-port fwln183i0
Jan 22 17:16:09 dc1-pc-tac84 ovs-vsctl: ovs|00002|db_ctl_base|ERR|no port named fwln183i0
Jan 22 17:16:09 dc1-pc-tac84 ovs-vsctl: ovs|00001|vsctl|INFO|Called as /usr/bin/ovs-vsctl del-port tap183i0
Jan 22 17:16:09 dc1-pc-tac84 qmeventd[2605]: Finished cleanup for 183

Since then it wont start. We can't repair either as everytime I try it fails with a cannot allocate memory error.

A check shows this:

root@dc1-pc-tac84:/var/lib/vz/images/183# qemu-img info vm-183-disk-2.qcow2
image: vm-183-disk-2.qcow2
file format: qcow2
virtual size: 200G (214748364800 bytes)
disk size: 268G
cluster_size: 65536
Snapshot list:
ID TAG VM SIZE DATE VM CLOCK
1 prekafka 0 2020-11-25 13:21:22 2162:21:34.221
Format specific information:
compat: 1.1
lazy refcounts: false
refcount bits: 16
corrupt: true


The only advice I have found is this:

# modprobe nbd
# qemu-nbd --connect=/dev/nbd0 bad_file.qcow2
# ddrescue /dev/nbd0 new_file.raw
# qemu-nbd --disconnect /dev/nbd0
# qemu-img convert -O qcow2 new_file.raw new_file.qcow2


Any ideas before I try this.

Cheers
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!