Share host filsystem to guest using virtfs 9p filesystem passthrough

Virtfs is a virtualization aware filesystem passthrough..Sharing host files on the guest through generic network file systems like NFS and CIFS suffer from major performance and feature deficiencies as these protocols are not designed or optimized for virtualization. To address the needs of
the virtualization paradigm, a new paravirtualized file system called VirtFS has been intorduced. Virtfs takes features of 9p2000.L protocol.

Using virtfs, you can share filesystem of host to the guest system. It works via para virtual transport mechanism called ‘virtio’. Virtfs has been implemented with ‘zero copy’ mechanism. This is a key advantage of VirtFS compared to using a network file system which would always require at least one (but usually more) data copies.

There are mainly 2 components in this implementation.

1)  virtio-9p-pci device ::

This will be used to transport protocol messages and data between the host
and the guest.

2) ‘fsdev’ device :

This is used to define the export file system characteristics like file
system type, security model .

For more about the implementation details,please  look at reference section..

Below is demo of this feature in “qemu” , “kvm”, “libvirt” environment.

Host system details : Fedora 15 :

Guest System details:  Fedora 16:

First of all, check support for above mentioned components ( virtio-9p-pci & fsdev) in host system qemu-kvm binary..


Guest Kernel has to support 9p:


The below string has to be specified with ‘qemu-kvm’ process to export a ‘virtfs’ filesystem for guest.

-virtfs local,path=[path to share],security_model=[mapped|passthrough|
none],mount_tag=[mount tag]

Where : Path = Sharing filesystem path
security_model: This can be either “mapped” or “passthrough”..
mount_tag: This is the idenitifier which can be used in guest when moutning.

The easiest way for defining this is, placing it in the guest configuration file..

After placing this in “guest configuration” file:

Start the guest :

ex: virsh create Fedora-16.xml

Check for “qemu-kvm” process to know whether “virtfs” options has been picked properly..


You have to mount the shared filesystem using “9p” . Use below command for the same:

#mount -t 9p -o trans=virtio test_mount /mnt


Filesyste type: 9p
Transport mechanism: virtio
Mount tag: This is the tag ‘test_mount’ which used when sharing from host system.
Mount Point: /mnt

Check for filesystem :




1 thought on “Share host filsystem to guest using virtfs 9p filesystem passthrough”

Leave a Reply

Your email address will not be published. Required fields are marked *