qemu-block
[Top][All Lists]
Advanced

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

Re: [Qemu-block] qemu-img: add seek option to dd


From: Richard W.M. Jones
Subject: Re: [Qemu-block] qemu-img: add seek option to dd
Date: Sat, 23 Feb 2019 07:27:01 +0000
User-agent: Mutt/1.5.21 (2010-09-15)

On Fri, Feb 22, 2019 at 03:59:07PM +0100, Max Reitz wrote:
> On 20.02.19 06:54, Richard W.M. Jones wrote:
> > It seems like it's not easy to write to a place in a qcow2 file using
> > qemu-io or qemu-img.  For example suppose I want to overwrite blocks
> > 100 and 101 with my own data:
> > 
> > $ qemu-img dd -f raw -O qcow2 bs=4096 skip=100 count=2 \
> >               if=/tmp/input.raw of=/tmp/disk.qcow2
> > qemu-img: /tmp/input.raw: cannot skip to specified offset
> > 
> > Skip is skipping the input, not the output.  Turning to qemu-io, it
> > doesn't look like you can control the data written (only write
> > patterns).
> > 
> > This patch looks good, but AFAICT it never went upstream:
> > 
> >   https://patchwork.kernel.org/patch/9273161/
> >   "qemu-img: add seek option to dd"
> > 
> > Is there anything I'm missing?  What is the status of that patch?
> 
> Eric sent another version last year:
> 
> http://lists.nongnu.org/archive/html/qemu-block/2018-08/msg00513.html
> 
> My main issue is that dd should be a frontend to convert, but it still
> isn't.  On top, I don't see why we need feature parity with dd when it's
> also possible to use qemu-nbd and just the normal dd.

Thanks for the link Max.  It didn't turn up in my previous searches.

I agree we shouldn't be trying to recreate ‘dd’, however the actual
nuts and bolts of using an NBD loop mount + dd are that you need root
and there are quite a lot of moving parts and things that need to be
cleaned up.  Plus there's actual peril if the host kernel has
VFS-related vulnerabilities.  Of course the reasons we wrote
libguestfs ...

> (Or qemu-blkfuse for which I should sent patches one of these days...)
> 
> I think it's wrong to re-implement existing tools in qemu.  Instead, we
> should work on making it simpler for those existing tools to access qemu
> images.

Yes, probably the answer here is a more supportable "qemu-io"
alternative, perhaps outside the qemu project and related to having a
simple C-based nbd client library, something I've wanted to do for a
long time but not got around to.

FYI nbdkit test suite "abuses" (sort of) qemu-io to help us test the
server.

> Note that while I did rant a bit about the concept of Eric's patch, I
> didn't object it in principle.  I pointed out two technical issues, Eric
> talked about a v2, but that never appeared, I think.

Thanks,

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-top is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://people.redhat.com/~rjones/virt-top



reply via email to

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