2017-07-28 0:31 GMT+08:00 Richard W.M. Jones <rjones@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@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

why