[Libguestfs] performance between guestfish and qemu-nbd

Richard W.M. Jones rjones at redhat.com
Fri Jul 28 08:13:10 UTC 2017


On Fri, Jul 28, 2017 at 03:53:26PM +0800, lampahome wrote:
> 2017-07-28 0:31 GMT+08:00 Richard W.M. Jones <rjones at redhat.com>:
> 
> > On Fri, Jul 28, 2017 at 12:23:04AM +0800, lampahome wrote:
> > > 2017-07-27 20:18 GMT+08:00 Richard W.M. Jones <rjones at redhat.com>:
> > >
> > > > On Thu, Jul 27, 2017 at 06:34:13PM +0800, lampahome wrote:
> > > > > I can mount qcow2 img to nbd devices through guestfish or qemu-nbd
> > > > >
> > > > > I'm curious about which performance is better?
> > > >
> > > > They do quite different things, they're not comparable.
> > > >
> > > > Can you specifically give the commands you are trying?  We might be
> > > > able to give more sensible advice.
> > >
> > > guestfish:
> > > guestfish --rw -a demo.qcow2 -m /dev/nbd0
> > >
> > > qemu-nbd:
> > > qemu-nbd -c /dev/nbd0 demo.qcow2
> >
> > These don't do the same thing.  In fact the guestfish command doesn't
> > work at all.
> >
> > > I just want to mount demo.qcow2 to a device
> >
> > Still unclear.
> >
> > You want to export demo.qcow2 as NBD?  Use qemu-nbd.
> >
> > You want to mount demo.qcow2 on the local filesystem?  (This doesn't
> > involve NBD.)  Use:
> >
> >   mkdir /tmp/mnt
> >   guestmount --rw -a demo.qcow2 -i /tmp/mnt
> >
> > Rich.
> >
> > --
> > Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~
> > rjones
> > Read my programming and virtualization blog: http://rwmj.wordpress.com
> > virt-df lists disk usage of guests without needing to install any
> > software inside the virtual machine.  Supports Linux and Windows.
> > http://people.redhat.com/~rjones/virt-df/
> 
> 
> I tried this:
> 
> > mkdir /tmp/mnt
> > guestmount --rw -a demo.qcow2 -i /tmp/mnt
> 
> but it shows guestmount no operating sys found on the disk
> If using guestmount -i remove this option and choose the filesystems you
> want to see by manually adding -m options

The FAQ covers what the -i option is doing:

  http://libguestfs.org/guestfs-faq.1.html#whats-the-deal-with-guestfish--i

If demo.qcow2 doesn't contain a real operating system then you will
need to replace -i with one or more -m options to specify the
filesystems that you want to be visible under /tmp/mnt, eg to make the
first partition of the disk visible:

  guestmount --rw -a demo.qcow2 -m /dev/sda1 /tmp/mnt

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine.  Supports Linux and Windows.
http://people.redhat.com/~rjones/virt-df/




More information about the Libguestfs mailing list