All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] Can I convert backing file to internal snapshot?
@ 2018-09-12  7:35 lampahome
  2018-09-12  7:44 ` Fam Zheng
  0 siblings, 1 reply; 5+ messages in thread
From: lampahome @ 2018-09-12  7:35 UTC (permalink / raw)
  To: QEMU Developers

I have two qcow2 A & B, and A is backing file of B.

Can I convert both A&B to one image and containing data of both?

ex:
one new image will contain data of A and B. When I check it by qemu-img
info, I can see one snapshot in the new image.

thanks

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] Can I convert backing file to internal snapshot?
  2018-09-12  7:35 [Qemu-devel] Can I convert backing file to internal snapshot? lampahome
@ 2018-09-12  7:44 ` Fam Zheng
  2018-09-14  4:23   ` lampahome
  0 siblings, 1 reply; 5+ messages in thread
From: Fam Zheng @ 2018-09-12  7:44 UTC (permalink / raw)
  To: lampahome; +Cc: QEMU Developers

On Wed, 09/12 15:35, lampahome wrote:
> I have two qcow2 A & B, and A is backing file of B.
> 
> Can I convert both A&B to one image and containing data of both?
> 
> ex:
> one new image will contain data of A and B. When I check it by qemu-img
> info, I can see one snapshot in the new image.

I believe it's possible to create an internal snapshot in A and then qemu-img
commit B to A. From here, the active content is B, and the snapshot is A.

Fam

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] Can I convert backing file to internal snapshot?
  2018-09-12  7:44 ` Fam Zheng
@ 2018-09-14  4:23   ` lampahome
  2018-09-14  6:05     ` Fam Zheng
  0 siblings, 1 reply; 5+ messages in thread
From: lampahome @ 2018-09-14  4:23 UTC (permalink / raw)
  To: Fam Zheng; +Cc: QEMU Developers

Can I convert from internap snapshot to external snapshot?
If there's 3 snapshots in one qcow2, can I convert them all to external
snapshots?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] Can I convert backing file to internal snapshot?
  2018-09-14  4:23   ` lampahome
@ 2018-09-14  6:05     ` Fam Zheng
  2018-09-14 14:52       ` Eric Blake
  0 siblings, 1 reply; 5+ messages in thread
From: Fam Zheng @ 2018-09-14  6:05 UTC (permalink / raw)
  To: lampahome; +Cc: QEMU Developers

On Fri, 09/14 12:23, lampahome wrote:
> Can I convert from internap snapshot to external snapshot?
> If there's 3 snapshots in one qcow2, can I convert them all to external
> snapshots?

Qcow2 doesn't track internal snapshot dependencies like external snapshot, so
there is no direct way to create the "differentiative" or "delta" images in the
same way as would be with external snapshots. In theory it's possible to convert
all internal snapshots to separate full images then create delta by
sector-by-sector comparison.

Fam

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] Can I convert backing file to internal snapshot?
  2018-09-14  6:05     ` Fam Zheng
@ 2018-09-14 14:52       ` Eric Blake
  0 siblings, 0 replies; 5+ messages in thread
From: Eric Blake @ 2018-09-14 14:52 UTC (permalink / raw)
  To: Fam Zheng, lampahome; +Cc: QEMU Developers

On 9/14/18 1:05 AM, Fam Zheng wrote:
> On Fri, 09/14 12:23, lampahome wrote:
>> Can I convert from internap snapshot to external snapshot?
>> If there's 3 snapshots in one qcow2, can I convert them all to external
>> snapshots?
> 
> Qcow2 doesn't track internal snapshot dependencies like external snapshot, so
> there is no direct way to create the "differentiative" or "delta" images in the
> same way as would be with external snapshots. In theory it's possible to convert
> all internal snapshots to separate full images then create delta by
> sector-by-sector comparison.

In fact, qemu-img documents that you can do:

            You can use "rebase" to perform a "diff" operation on two disk
            images.  This can be useful when you have copied or cloned a 
guest,
            and you want to get back to a thin image on top of a template or
            base image.

            Say that "base.img" has been cloned as "modified.img" by copying
            it, and that the "modified.img" guest has run so there are 
now some
            changes compared to "base.img".  To construct a thin image 
called
            "diff.qcow2" that contains just the differences, do:

                    qemu-img create -f qcow2 -b modified.img diff.qcow2
                    qemu-img rebase -b base.img diff.qcow2

            At this point, "modified.img" can be discarded, since 
"base.img +
            diff.qcow2" contains the same information.


So yes, the process is to first use multiple 'qemu-img convert -l' to 
extract the separate points in time into separate files, and then 
'qemu-img rebase' as above to convert those separate points in time back 
into differential files.

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-09-14 14:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-12  7:35 [Qemu-devel] Can I convert backing file to internal snapshot? lampahome
2018-09-12  7:44 ` Fam Zheng
2018-09-14  4:23   ` lampahome
2018-09-14  6:05     ` Fam Zheng
2018-09-14 14:52       ` Eric Blake

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.