qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: qemu-devel@nongnu.org
Cc: mreitz@redhat.com, fullmanet@gmail.com, qemu-block@nongnu.org
Subject: [Qemu-devel] [PATCH 0/2] Improve qemu-img dd
Date: Tue, 14 Aug 2018 21:56:12 -0500	[thread overview]
Message-ID: <20180815025614.53588-1-eblake@redhat.com> (raw)

I was trying to test NBD fleecing by copying subsets of one
file to another, and had the idea to use:

$ export NBD drive to be fleeced on port 10809
$ qemu-img create -f qcow2 copy $size
$ qemu-nbd -f qcow2 -p 10810 copy
$ qemu-img dd -f raw -O raw if=nbd://localhost:10809 of=nbd://localhost:10810 \
    skip=$offset seek=$offset count=$((len/cluster)) bs=$cluster

except that seek= wasn't implemented. And in implementing that,
I learned that skip= is broken when combined with count=.

[In the meantime, I had to use:

$ export NBD drive to be fleeced on port 10809
$ modprobe nbd
$ qemu-nbd -c /dev/nbd0 -f raw nbd://localhost:10809
$ qemu-nbd -c /dev/nbd1 -f qcow2 copy
$ dd if=/dev/nbd0 of/dev/nbd1 \
    skip=$offset seek=$offset count=$((len/cluster)) bs=$cluster

to get the behavior I needed (basically, create an empty qcow2
destination file, then plug in the guest-visible data based on
the subsets of the disk of my choosing, by reading the block
status/dirty bitmap over NBD).  But bouncing through three
NBD client/server pairs just so I can use plain 'dd' instead
of just two pairs with 'qemu-img dd' feels dirty.
]

Eric Blake (2):
  qemu-img: Fix dd with skip= and count=
  qemu-img: Add dd seek= option

 qemu-img.c                 |  76 ++++++----
 tests/qemu-iotests/160     |  15 +-
 tests/qemu-iotests/160.out | 344 ++++++++++++++++++++++++++++++++++++++++++++-
 3 files changed, 397 insertions(+), 38 deletions(-)

-- 
2.14.4

             reply	other threads:[~2018-08-15  2:56 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-15  2:56 Eric Blake [this message]
2018-08-15  2:56 ` [Qemu-devel] [PATCH 1/2] qemu-img: Fix dd with skip= and count= Eric Blake
2018-08-16  2:03   ` Max Reitz
2018-08-16  2:17     ` Eric Blake
2018-08-16  2:19       ` Max Reitz
2018-08-15  2:56 ` [Qemu-devel] [PATCH 2/2] qemu-img: Add dd seek= option Eric Blake
2018-08-16  2:20   ` Max Reitz
2018-08-16  2:39     ` Eric Blake
2018-08-16  2:49       ` Eric Blake
2018-08-16  2:49       ` Max Reitz
2018-08-16  2:57         ` Eric Blake
2018-08-16  3:00           ` Max Reitz
2018-08-16  7:15         ` Kevin Wolf
2018-08-17 19:22           ` Max Reitz
2018-08-20  2:07     ` Fam Zheng
2018-08-20 12:20       ` Max Reitz
2018-08-16  2:04 ` [Qemu-devel] [PATCH 0/2] Improve qemu-img dd Eric Blake
2018-08-16  2:12 ` Eric Blake
2018-08-16 19:39 ` no-reply
2018-08-16 20:00 ` no-reply

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=20180815025614.53588-1-eblake@redhat.com \
    --to=eblake@redhat.com \
    --cc=fullmanet@gmail.com \
    --cc=mreitz@redhat.com \
    --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).