Hi Alon, further to the discussion on IRC ...
I would try a script like the one below. Highlights:
* It avoids using the '-i' option, because that can be slow. The down
side is that you have to specify which partition contains the C:
drive because that information is no longer available from
inspection.
* We only use guestfish once, so you don't have to repeatedly start up
the appliance.
* Takes 4 seconds to run on my machine.
----------------------------------------------------------------------
#!/bin/bash -
# Note: replace /dev/sda2 with the C:\ drive
guestfish -a /tmp/win.qcow2 -m /dev/sda2 <<'EOF'
copy-in /tmp/driver.sys win:/windows/system32/
copy-in /tmp/driver.inf win:/windows/system32/
-rm-rf win:/Temp/testprogs
-mkdir win:/Temp
copy-in /tmp/testprogs win:/Temp/
EOF
----------------------------------------------------------------------
I tested this by doing:
$ qemu-img create -f qcow2 -o backing_file=/dev/vg_pin/Win7x32 win.qcow2
Formatting 'win.qcow2', fmt=qcow2 size=21474836480
backing_file='/dev/vg_pin/Win7x32' encryption=off cluster_size=65536
and creating some dummy driver.sys, driver.inf, testprogs directory
(about 1 MB of data).
I then tested the script above and it took 4 seconds on my machine.
If it's substantially slower for you, let me know. I recommend also
using the guestfish -x option so that you get to see all the
libguestfs API calls that guestfish is making.
Rich.
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
virt-top is 'top' for virtual machines. Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://et.redhat.com/~rjones/virt-top