Storage for Kata Containers - 9pfs vs virtio-blk

Published: (December 29, 2025 at 01:34 PM EST)
2 min read
Source: Dev.to

Source: Dev.to

Comparison table for 9pfs vs virtio-blk

9pfs (virtio-9p)

9pfs exposes a specific directory on the host machine directly to the guest. It is often used for “shared folders” where the host and guest need simultaneous access to the same files.

Pros

  • Elasticity – Storage is only consumed by actual files on the host; no need to pre‑allocate a large image file.
  • Ease of Use – Ideal for development: edit code on the host and run it immediately in the guest.

Cons

  • Performance – Generally slower than block devices because every file operation must go through the 9P protocol and host system calls.
  • Compatibility – Linux support is excellent, but Windows support is limited and often requires third‑party drivers.
  • Modern Alternativevirtio-fs is the successor to 9pfs in many modern QEMU setups, offering significantly better performance and POSIX compliance.

virtio-blk

This presents a virtual raw block device (a “hard drive”) to the guest. The guest OS treats it like a physical disk and manages its own filesystem (e.g., ext4, XFS) on top of it.

Pros

  • High Performance – Optimized for low latency and high throughput. Features like IOThread Virtqueue Mapping (introduced in QEMU 9.0) allow it to scale across multiple vCPUs efficiently.
  • Full Feature Support – Supports TRIM/Discard (to reclaim space), bootable partitions, and standard disk‑management tools.

Cons

  • Isolation – The host cannot easily “see” or edit files inside the block device while the guest is running without risking corruption.
  • Fixed Size – Typically requires pre‑allocation or the use of “sparse” image formats (e.g., QCOW2), which can have their own performance trade‑offs.

When to use which

Use 9pfs when

  • You need to share a host directory into a guest for development, simple file exchange, or testing.
  • You value ease of sharing over raw performance and strict isolation.

Use virtio-blk when

  • You are provisioning a root disk or data disk for a VM.
  • You care about performance, isolation, and standard disk semantics (snapshots, independent filesystems per VM).
Back to Blog

Related posts

Read more »

A file-based agent memory framework

Introduction Hi everyone, we've open‑sourced a file‑based agent memory framework called memU. If you find it interesting, a GitHub star ⭐️ would be much apprec...