On Thu 13 Sep 2018 08:37:05 PM CEST, Max Reitz wrote:
> First, split .003 into the part we want to commit and the part we
> don't want to commit. This is a bit tricky without qemu-img dd @seek
> (or a corresponding convert parameter), so we'll have to make do with
> backing=null so we don't copy anything into the output from img.003's
> backing chain.
>
> Or, we would have to use backing=null, but for some reason that
> doesn't work. I'll have to investigate.
>
> So rebase will need to do:
>
> $ qemu-img rebase -u -b '' img.003
>
> $ qemu-img convert -O qcow2 \
> "json:{'driver':'raw','offset':0,'size':1048576,\
> 'file':{'driver':'qcow2',\
> 'file':{'driver':'file','filename':'img.003'}}}" \
> "json:{'driver':'null-co','size':2097152}" \
> img.003.commit.000
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
> $ 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
Berto