how does qemu-img merge the QCOW2 delta images

狂风中的少年 提交于 2020-01-07 00:36:12

问题


Hello everyone, I am a newcomer. I am learning OpenStack and kvm,but now I met a difficult problem:

     I have a qcow2 image A, 

     a qcow2 delta image B whose backing file is A, 

     and a qcow2 image C whose backing file is B.

     Now I want to merge the B and C into a qcow2 image D whose backing file is A.

     I have tried to use qemu-img to solve it, but still didn't get positive solutions.

I hope you can help me, really appreciate.


回答1:


With the vm in question currently running use a virsh blockpull.

virsh blockpull --domain vmname --path /var/lib/libvirt/images/c.qcow2

this assumes vmname is the vm using c.qcow2 which is backed by b.qcow2 which is backed by a.qcow2. If you'd like a file other than c.qcow2 to be the final new complete backless file, then use the vm and create a d.qcow2 first and name it in the virsh command. This will leave a,b,c intact and pull a+b+c into d.

And yes, the domain is to be up and running while you do it.




回答2:


cp C D
qemu-img rebase -b A D

This creates a copy of C called D and then rebases D on A.



来源:https://stackoverflow.com/questions/37323620/how-does-qemu-img-merge-the-qcow2-delta-images

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!