qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] qemu-img: Implement 'diff' operation.


From: Richard W.M. Jones
Subject: Re: [Qemu-devel] [PATCH] qemu-img: Implement 'diff' operation.
Date: Thu, 17 May 2012 15:01:36 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

On Thu, May 17, 2012 at 02:52:56PM +0100, Peter Maydell wrote:
> On 17 May 2012 14:44, Richard W.M. Jones <address@hidden> wrote:
> > From: "Richard W.M. Jones" <address@hidden>
> >
> > This produces a qcow2 file which is the different between
> > two disk images.  ie, if:
> >
> >  original.img - is a disk image (in any format)
> >  modified.img - is a modified version of original.img
> >
> > then:
> >
> >  qemu-img diff -b original.img modified.img diff.qcow2
> >
> > creates 'diff.qcow2' which contains just the differences.  Note that
> > 'diff.qcow2' has 'original.img' set as the backing file.
> 
> Any chance of some more detailed explanation in the docs patch
> about what this actually means and why it's useful? I spent
> several minutes going "huh, does it even mean anything to
> calculate the difference between two binary disk images?"
> before realising that it's the presence of the backing file
> that makes it actually make sense...

Well I'll say first of all that I was asked to implement this by a
colleague.  Personally, I'm far more organized than this, and I always
use snapshots and backing files if I want to create an efficient COW
from a base template :-)

However my colleague has got himself into a situation where he has
copied (ie. "cp" or equivalent) a guest several times from a template,
and these guests have been running independently.  He now wants to
conserve disk space by turning this situation back into one where he
has one backing file + several COW copies.

To do this, he can (with this patch) do:

  qemu-img diff -b base.img the_copied_guest.img guest.qcow2
  rm the_copied_guest.img

'guest.qcow2' will (in theory at least) be much smaller than the
copied guests he has right now.

Does that make sense?

[BTW I'm still working on this.  There are a few spelling mistakes and
it needs a lot more testing.  This patch is just for comment at the
moment.]

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
libguestfs lets you edit virtual machines.  Supports shell scripting,
bindings from many languages.  http://libguestfs.org



reply via email to

[Prev in Thread] Current Thread [Next in Thread]