Virtiofs 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.
Virtiofs was started at Red Hat and is being developed in the Linux, QEMU, FUSE, and Kata Containers open source communities.
See the design document for a more in-depth explanation of virtiofs.
Available in mainline since Linux 5.4, QEMU 5.0, libvirt 6.2, and Kata Containers 1.7.
The new virtiofsd-rs Rust daemon is receiving the most attention for new feature development.
Chat: #virtiofs on Matrix
Mailing list: email@example.com (list info)
Community call: Bi-weekly on Wednesdays via video conference or phone (meeting ID 318831955). Meeting times and agenda.
Virtiofs 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 virtiofs 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.
Virtiofs takes advantage of the virtual machine’s co-location with the hypervisor to avoid overheads associated with network file systems.
Virtiofs uses FUSE as the foundation. Unlike traditional FUSE where the file system daemon runs in userspace, the virtiofs 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 virtiofs 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.