Virtio-fs is a shared file system that lets virtual machines access a directory tree on the host. Unlike existing approaches, it is designed to offer local file system semantics and performance.
Virtio-fs was started at Red Hat and is being developed in the Linux, QEMU, FUSE, and Kata Containers communities that are affected by code changes.
Virtio-fs is under development and suitable for early benchmarking and testing.
Linux, QEMU, libfuse, and Kata Containers repositories available here. See the HowTos for setup instructions.
Virtio-fs is not a network file system repurposed for virtualization, it is specifically designed to take advantage of the locality of virtual machines and the hypervisor.
The goal of virtio-fs is to provide local file system semantics between multiple virtual machines sharing a directory tree. This is especially useful for lightweight VMs and container workloads, where shared volumes are a requirement.
Existing solutions to this problem, such as virtio-9p, are based on existing network protocols that are not optimized for virtualization use cases. As a result they do not perform as well as local file systems and do not provide the semantics that some applications rely on.
Virtio-fs takes advantage of the virtual machine’s co-location with the hypervisor to avoid overheads associated with network file systems.
Virtio-fs uses FUSE as the foundation. Unlike traditional FUSE where the file system daemon runs in userspace, the virtio-fs daemon runs on the host. A VIRTIO device carries FUSE messages and provides extensions for advanced features not available in traditional FUSE.
FUSE has no dependencies on a networking stack and exposes a rich native Linux file system interface that allows virtio-fs to act like a local file system.
File contents can be mapped into a memory window on the host, allowing the guest to directly access data from the host page cache. This has several advantages:
A metadata version table in shared memory provides coherent access for multiple virtual machines without expensive communication. Version numbers for file system metadata are implemented using atomic compare-and-swap operations. Virtual machines refresh metadata when the version number has changed since they last cached a copy.