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?

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
libguestfs lets you edit virtual machines.  Supports shell scripting,
bindings from many languages.  http://libguestfs.org

Reply via email to