From: Max Reitz <mreitz@redhat.com>
To: lampahome <pahome.chen@mirlab.org>,
QEMU Developers <qemu-devel@nongnu.org>,
Qemu-block <qemu-block@nongnu.org>
Subject: Re: [Qemu-devel] Can I only commit from active image to corresponding range of its backing file by qemu cmd?
Date: Thu, 13 Sep 2018 15:22:29 +0200 [thread overview]
Message-ID: <ce6e31f1-0190-89ea-3aae-90ccdf81c585@redhat.com> (raw)
In-Reply-To: <CAB3eZfsvnyyo0C4nU=Mucg51krnN9Q9ExKA0t4AEEA3DiOd2aA@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 2314 bytes --]
On 13.09.18 05:33, lampahome wrote:
> I split data to 3 chunks and save it in 3 independent backing files like
> below:
> img.000 <-- img.001 <-- img.002
> img.000 is the backing file of img.001 and 001 is the backing file of 002.
> img.000 saves the 1st chunk of data and img.001 saves the 2nd chunk of
> data, and img.002 saves the 3rd chunk of data.
>
> Now I have img.003 stores cow data of 1st chunk and img.002 is the backing
> file of img.003.
> The backing chain is like this:
> img.000 <-- img.001 <-- img.002 <-- img.003
>
> So that means the data of img.003 saves the same range with img.000 but
> different data.
>
> I know I can use *`qemu-img commit'* but it only commit the data from
> img.003 to img.002.
>
> If I use *`qemu-img rebase -b img.000 img.003`*, the data of img.001 and
> img.002 will merge into img.003.
>
> What I want is only commit the data in img.003 into img.000 because the
> data of the two image are the same range(1st chunk)
>
> Is there anyway to commit(or merge) data of active image into corresponding
> backing file?
So img.000, img.001, and img.002 all contain data at completely
different areas, and img.003 only contains data where img.000 contains
data as well?
Say like so:
$ qemu-img create -f qcow2 img.000 3M
$ qemu-img create -f qcow2 -b img.000 img.001
$ qemu-img create -f qcow2 -b img.001 img.002
$ qemu-img create -f qcow2 -b img.002 img.003
$ qemu-io -c 'write -P 1 0M 1M' img.000
$ qemu-io -c 'write -P 2 1M 1M' img.001
$ qemu-io -c 'write -P 3 2M 1M' img.002
$ qemu-io -c 'write -P 4 0M 1M' img.003
(img.000 contains 1s from 0M to 1M;
img.001 contains 2s from 1M to 2M;
img.002 contains 3s from 2M to 3M;
img.003 contains 4s from 0M to 1M (the range of img.000))
In that case, rebase -u might be what you want, so the following should
work (although it can easily corrupt your data if it isn't the case[1]):
$ qemu-img rebase -u -b img.000 img.003
$ qemu-img commit img.003
(And then maybe
$ qemu-img rebase -u -b img.002 img.003
to return to the previous backing chain.)
Max
[1] It will corrupt your data if img.001 or img.002 contain any data
where img.003 also contains data; because then that data of img.003 will
be hidden when viewed through img.001 and img.002.
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2018-09-13 13:22 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-13 3:33 [Qemu-devel] Can I only commit from active image to corresponding range of its backing file by qemu cmd? lampahome
2018-09-13 13:22 ` Max Reitz [this message]
2018-09-13 17:05 ` Eric Blake
2018-09-13 18:37 ` Max Reitz
2018-09-13 19:41 ` Max Reitz
2018-09-13 20:06 ` Eric Blake
2018-09-13 20:01 ` Eric Blake
2018-09-13 20:44 ` Max Reitz
2018-09-14 2:19 ` lampahome
2018-09-14 14:48 ` Eric Blake
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ce6e31f1-0190-89ea-3aae-90ccdf81c585@redhat.com \
--to=mreitz@redhat.com \
--cc=pahome.chen@mirlab.org \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).