Overview

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.

Status

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.

Community

Chat: #virtiofs on Matrix

Mailing list: virtio-fs@lists.linux.dev (list info)

Community call: Bi-weekly on Wednesdays via video conference or phone (meeting ID 318831955). Meeting times and agenda.

HowTo

Frequently Asked Questions

Why virtiofs?

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.

Why a new file system?

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.

How does it work?

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.

How does virtiofs exploit Direct Access (DAX)? [experimental]

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:

How does virtiofs support coherence for metadata? [experimental]

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.