[Virtio-fs] How to setup virtiofs for file sharing between host and VM

Vivek Goyal vgoyal at redhat.com
Mon Jun 8 13:35:06 UTC 2020


On Fri, Jun 05, 2020 at 11:50:06AM +0100, Boris Ebwanga wrote:
> Hello everyone.
> 
> It's been a while now, I am trying to use virtio-fs. Everything I do end up
> with an error.
> 
> First I was on fedora 31 and I tried to run manually qemu with virtio-fs
> https://virtio-fs.gitlab.io/howto-qemu.html. But I was not able to "make
> virtiofsd".
> 
> Then, I upgraded to fedora 32 which has virtiofsd at /usr/libexec. I
> followed the steps describe at
> https://libvirt.org/kbase/virtiofs.html
> I could not modify the XML domain of my VM. The error message is "*unsupported
> configuration: unknown fs virtiofs » driver type".*

Hi Boris,

Ccing Jan Tomko. He might have toughts on this.


> 
> I wrote to Stefan Hajnoczi <stefanha at redhat.com> describing this problem.
> He answers with the following:
> 
> Hi Boris,
> > You can pass command-line options to the guest like this:
> >
> >   <domain type='kvm' xmlns:qemu='
> > http://libvirt.org/schemas/domain/qemu/1.0'>
> >     ...
> >     <qemu:commandline>
> >       <qemu:arg value='-chardev'/>
> >       <qemu:arg value='socket,id=char0,path=/tmp/vhost-fs.sock'/>
> >       <qemu:arg value='-device'/>
> >       <qemu:arg
> > value='vhost-user-fs-pci,chardev=virtio-fs-chardev,tag=myfs'/>
> >     </qemu:commandline>
> >   </domain>
> >
> > Note that the xmlns in the <domain> tag is required.
> >
> > If you pass these options manually then you need to launch virtiofsd
> > yourself before launching the guest:
> >
> >   # /usr/libexec/virtiofsd --socket-path=/tmp/vhost-fs.sock -o
> > source=/path/to/share/dir -o no_posix_lock -o xattr
> >
> > Hope this helps! Please email virtio-fs at redhat.com if you have any more
> > questions, it's the virtio-fs mailing list and others will be able to
> > participate in the discussion.
> >
> 
> I am still getting the same error after applying the change above.
> 
> Can anyone help me with this ? Thank you in advance for your help.

Can you attach your domain xml file here.

I think you also will need to add following in <qemu:commandline> section.


    <qemu:arg value='-object'/>
    <qemu:arg value='memory-backend-file,id=mem,size=8G,mem-path=/dev/shm,share=on'/>
    <qemu:arg value='-numa'/>
    <qemu:arg value='node,memdev=mem'/>

Thanks
Vivek




More information about the Virtio-fs mailing list