I am trying to use virsh and domain xml to launch a Centos 7 guest from ubuntu 16.04 LTS host. The "filesystem" node that i am using in domain xml is as below:

<filesystem type='mount' accessmode='passthrough'>
    <driver type='path' wrpolicy='immediate'/>
     <source dir='/opt/test'/>
     <target dir='testlabel'/>

With the above config, "testlabel" is not visible in the guest and hence i am not able to mount it. Is there anything that i am missing?

I tried to have 9p modules in guest but they don't seem to be available in centos 7 readily. Needs kernel re-compilation [trying it now]. I learnt that virtio-vsock is going to be available in the future. So, it is not an option for now.

I do not want to use network based file sharing like SSHFS, NFS or glusterfs either.

Is there any other filesystem driver that can work with the "filesystem" option of domain xml with libvirt?


According to the libvirt documentation, you might simply need to adjust your target.

The docs provide the following examples:

  <filesystem type='mount' accessmode='passthrough'>
    <driver type='path' wrpolicy='immediate'/>
    <source dir='/export/to/guest'/>
    <target dir='/import/from/host'/>
  <filesystem type='file' accessmode='passthrough'>
    <driver name='loop' type='raw'/>
    <driver type='path' wrpolicy='immediate'/>
    <source file='/export/to/guest.img'/>
    <target dir='/import/from/host'/>

That seems to work without the need for 9p.

However, for centos, there is in fact a readily available 9p helper:

Available Packages
Name        : nfs-ganesha-mount-9P
Arch        : x86_64
Version     : 2.3.2
Release     : 1.el7
Size        : 11 k
Repo        : epel/x86_64
Summary     : a 9p mount helper
URL         : https://github.com/nfs-ganesha/nfs-ganesha/wiki
Licence     : LGPLv3+
Description : This package contains the mount.9P script that clients can use
            : to simplify mounting to NFS-GANESHA. This is a 9p mount helper.

At this time, 9p is the only filesystem sharing option that is supported by libvirt and KVM. Unfortunately 9p supported is disabled in CentOS since it has been largely unmaintained upstream for years & contained a number of security flaws - only in the past few months did a new 9p maintainer start work on cleaning this up. If you do recompile the centos kernel, or build the 9p module yourself though, it should be possible to make it work.

Until virtio-vsock with NFS support comes along, there's no other non-network based options you can use.

  • Thanks @DanielB . Centos Kernel re-compiling indeed seems to be the only option. – Swaru Apr 18 '17 at 5:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.