qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Vivier <Laurent.Vivier@bull.net>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH][RFC] To mount qemu disk image on the host
Date: Fri, 25 Jan 2008 16:49:13 +0100	[thread overview]
Message-ID: <1201276153.4114.57.camel@frecb07144> (raw)
In-Reply-To: <4799FDBE.6030502@codemonkey.ws>

Le vendredi 25 janvier 2008 à 09:18 -0600, Anthony Liguori a écrit :
> Laurent Vivier wrote:
> > Hi,
> >
> > this patch allows to mount qemu disk images on the host.
> >   

Sorry, I didn't see you did a similar work 19 months ago.

> Note, the general problem with this approach is that mounting a NBD 
> device locally with write access can lead to dead locks.  If you look 
> through the mailing list archives, you'll find a number of conversations 
> on the topic.

Yes, I experimented some problems with heavily loaded I/O (2 * dbench 64
on a 4 CPUs SMP)
But perhaps to edit config files or fsck partition of a virtual machine
it is acceptable.

What I'm wondering is how loop and device mapper can work ?

> Regards,
> 
> Anthony Liguori

Thank you,
Laurent

> > It is based on the Network Block Device protocol and allows qemu-img to
> > become an NBD server (Yes, Anthony, userspace block device is the right
> > way to do that... :-P ).
> >
> > Once you've applied the attached patch to Qemu and build the binaries,
> > you can use it like that:
> >
> > # ./qemu-img server -d 1234 etch.qcow2
> >
> > This starts an NBD server on port 1234. This server will expose
> > the disk image etch.qcow2. "-d" means it will be daemonize and will run
> > in background.
> >
> > Then you need to connect the block device to the server:
> >
> > # nbd-client localhost 1234 /dev/nbd0
> > Negotiation: ..size = 4194304KB
> > bs=1024, sz=4194304
> >
> > This will link etch.qcow2 to /dev/nbd0.
> >
> > Then to see partitions, you can use kpartx, as explained Daniel, or my
> > patched loop modules (I can send an updated and bug free version).
> > ...
> > # kpartx -a /dev/nbd0
> > ...
> > or
> > ...
> > # rmmod loop
> > # insmod drivers/block/loop.ko max_part=64
> > # losetup -f /dev/nbd0
> > ...
> > # mount /dev/loop0p1 /mnt
> > # ls /mnt
> > bench  cdrom    etc     initrd.img  media  proc  selinux  tmp  vmlinuz
> > bin    clients  home    lib         mnt    root  srv      usr
> > boot   dev      initrd  lost+found  opt    sbin  sys      var
> > # cd
> > # umount /mnt
> > # losetup -d  /dev/loop0
> > # nbd-client -d /dev/nbd0
> >
> > TODO: security/host client checking, device lock...
> >
> > As usual all comments are welcome,
> > have fun,
> > Laurent
> >   
> 
> 
> 
> 
-- 
----------------- Laurent.Vivier@bull.net  ------------------
  "La perfection est atteinte non quand il ne reste rien à
ajouter mais quand il ne reste rien à enlever." Saint Exupéry

  reply	other threads:[~2008-01-25 15:48 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-25 12:30 [Qemu-devel] [PATCH][RFC] To mount qemu disk image on the host Laurent Vivier
2008-01-25 12:48 ` Johannes Schindelin
2008-01-25 12:58   ` Laurent Vivier
2008-01-25 13:37     ` Alexander Graf
2008-01-25 13:51       ` Laurent Vivier
2008-01-25 15:11 ` Anthony Liguori
2008-01-25 15:18 ` Anthony Liguori
2008-01-25 15:49   ` Laurent Vivier [this message]
2008-01-25 19:52     ` Andre Przywara
2008-01-25 20:27       ` Anthony Liguori
2008-01-25 20:55         ` Daniel P. Berrange
2008-01-25 21:17       ` Laurent Vivier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1201276153.4114.57.camel@frecb07144 \
    --to=laurent.vivier@bull.net \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).