After recent crash of my laptop (hardware died) my QCOW2 images suffered minor damage and for the heck I couldn’t convince Fedora VM to auto-fsck itself so I had to go all manual after N-th prompt from dracut shell about problems starting up.
Turns out it’s not so complicated to get to the guts of the QCOW2 after all:
# modprobe nbd max_part=16 # qemu-nbd --connect=/dev/nbd0 /var/lib/libvirt/images/foo.qcow2 # fdisk -l /dev/nbd0 # pvscan # vgchange -a y fedora # fsck.ext4 -y /dev/fedora/rootfs # vgchange -a n fedora # qemu-nbd --disconnect /dev/nbd0
In above snippet “fedora” is my VM’s VG name and rootfs was the offending LV