<div dir="ltr">On 21 September 2012 21:40, Daniel P. Berrange <span dir="ltr"><<a href="mailto:berrange@redhat.com" target="_blank">berrange@redhat.com</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div class="HOEnZb"><div class="h5">On Fri, Sep 21, 2012 at 09:34:02PM +1000, Amos Shapira wrote:<br>
> On 21 September 2012 21:30, Daniel P. Berrange <<a href="mailto:berrange@redhat.com">berrange@redhat.com</a>> wrote:<br>
><br>
> > On Fri, Sep 21, 2012 at 09:22:24PM +1000, Amos Shapira wrote:<br>
> > > Hello,<br>
> > ><br>
> > > Is it possible to share a single host's Logical Volume among multiple<br>
> > local<br>
> > > KVM guests which mount it read-only?<br>
> > ><br>
> > > I'm asking this because I have an idea to run multiple idential KVM<br>
> > guests<br>
> > > (they all have exactly the same software installed on them), booting them<br>
> > > from a shared local Logical Volume read-only root file system, or<br>
> > > alternatively let them share the bulk of the software (/usr, /opt, /lib)<br>
> > > from a common KVM host Logical volume.<br>
> > ><br>
> > > Is this possible? All my searches so far failed to turn up anything like<br>
> > > this.<br>
> ><br>
> > From the libvirt POV, there's nothing much todo except add <readonly/><br>
> > inside the <disk> element. This will ensure QEMU only gets given read<br>
> > permission on the disk backend. The important thing is to then make sure<br>
> > your guests actually mount the filesystem with the readonly flag.<br>
> ><br>
> > > Would it be possible using qcow2 instead of raw LV? If so - would it be<br>
> > > worth the performance hit of switching from LV to qcow2?<br>
> ><br>
> > The type of backend storage doesn't really affect things if the<br>
> > disk is fully readonly.<br>
> ><br>
><br>
> Thanks very much! That's very helpful to know.<br>
><br>
> Is this something that someone has already done before (booting multiple<br>
> KVM guests from shared read-only root file system) or am I on my own with<br>
> this?<br>
<br>
</div></div>I've do it with libvirt-sandbox, but using a different approach. Instead<br>
of a shared readonly disk image, I use the plan9 filesystem to pass a<br>
chroot area from the host to the guest. Then I have to mount certain<br>
areas with tmpfs or other writable filesystems (eg /var, /tmp/, parts<br>
of /etc, etc).<br>
<br>
What you want todo is definitely doable - the hard part is just in making<br>
your OS image in a way to works with readonly root. This is typically not<br>
to well documented, so involves alot of trial and error at first.<br></blockquote><div><br>Thanks. I'll try to make my workplace interested in this and report back if/when I have interesting results.<br><br>In general, I'm thinking of replicating the way that diskless NFS clients used to boot from a common root file system on an NFS server, where the only difference among them is their MAC address, which in turn lets them pull a little different information (e.g. host name) from DHCP and use this as a basis to mount the private parts of the disk (e.g. /var, /etc?) and configuration.<br>

<br>The other question is whether I am correct in expecting that this could improve my disk IO profile, since all the guests would be accessing the same host's disk blocks.<br><br>Cheers,<br><br>--Amos  <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


<div class="HOEnZb"><div class="h5"><br>
Daniel<br>
--<br>
|: <a href="http://berrange.com" target="_blank">http://berrange.com</a>      -o-    <a href="http://www.flickr.com/photos/dberrange/" target="_blank">http://www.flickr.com/photos/dberrange/</a> :|<br>
|: <a href="http://libvirt.org" target="_blank">http://libvirt.org</a>              -o-             <a href="http://virt-manager.org" target="_blank">http://virt-manager.org</a> :|<br>
|: <a href="http://autobuild.org" target="_blank">http://autobuild.org</a>       -o-         <a href="http://search.cpan.org/~danberr/" target="_blank">http://search.cpan.org/~danberr/</a> :|<br>
|: <a href="http://entangle-photo.org" target="_blank">http://entangle-photo.org</a>       -o-       <a href="http://live.gnome.org/gtk-vnc" target="_blank">http://live.gnome.org/gtk-vnc</a> :|<br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><div dir="ltr">
            <a href="http://www.linkedin.com/in/gliderflyer" target="_blank">
            <span>
      
          <img src="http://s4.licdn.com/scds/common/u/img/webpromo/btn_viewmy_160x25.png" alt="View my profile on LinkedIn" height="25" width="160">
        
    </span></a></div><br>
</div>