I'm looking for a way to mount a read only snapshot of a qcow2 disk image so I can back up files from it. Based on the manpages for qemu-nbd a command like the following ought to work:
qemu-nbd -x myimage --read-only --snapshot /var/lib/libvirt/images/myvm.qcow2
However, when I run it I get the warning:
Failed to blk_new_open '/var/lib/libvirt/images/myvm.qcow2': Failed to get shared "write" lock
Is another process using the image?
My understanding of the above command is that it would create a backing file to keep writes away from myvm.qcow2 and would mount the image in read only mode anyway so there's no reason it would need to obtain a write lock. I'm struggling to find any info on this other than the manpages so am hoping someone has come across this before and might know if there is a way around it. I know that qemu-img has a -U flag to force access to the image even if there is a write lock. Is there a similar flag for qemu-nbd?
I am running running Ubuntu 18.04 using QEMU 2.11.1 and libvirt 4.0.0 if there are any known issues with those specific versions