On 9/25/18 9:13 AM, Alberto Garcia wrote:

If you only want to copy parts of a backing file I think it's much
simpler if you use copy-on-read:

qemu-io -C -c 'read 0 1M' img.003.commit.000

Oh, slick.


$ qemu-img convert -O qcow2 \
     "json:{'driver':'null-co','size':1048576}" \
     "json:{'driver':'raw','offset':1048576,'size':2097152,\
            'file':{'driver':'qcow2',\
                    'file':{'driver':'file','filename':'img.003'}}}" \
     img.003.nocommit

qemu-io -C -c 'read 1M 1M' img.003.nocommit

So use copy-on-read to extract the portions you care about into temporary files, then commit those temporary files into the target.

Beats my hacks using 'qemu-nbd -c /dev/nbdN' and then several dd processes as directed by 'qemu-img map --output=json' output.

--
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

Reply via email to