devutils/ATFQ/book ATFQ git

Part I · How it works

9.5 The VFS: one interface for every filesystem

alsovfsvirtual file systemvirtual filesystemfusenetwork filesystemnfssmbcifsvirtiofs9pstale file handle

TL;DR

  • Programs call open, read and write the same way whatever holds the file. The kernel's VFS turns those calls into the right filesystem's code.
  • So the same cat reads ext4 on a disk, NFS on a server, /proc made up by the kernel, or a FUSE filesystem written in Python.
  • FUSE runs a filesystem as an ordinary program: sshfs, rclone, ntfs-3g, AppImages.
cat /proc/filesystems    # filesystems this kernel knows
findmnt -t nfs,nfs4,cifs,fuse.sshfs,virtiofs

On your machine

alice@laptopexample
$ atfq 9.5
  /         btrfs on /dev/nvme0n1p2 · SSD mode
  /home     btrfs on /dev/nvme0n1p2 · SSD mode
  /var/lib/my data btrfs on /dev/nvme0n1p2 · SSD mode
  /boot/efi vfat on /dev/nvme0n1p1
  /media/usb exfat on /dev/sda
  /home     btrfs on /dev/nvme0n1p2

  Kernel    6.12.48-amd64, built with gcc 14.2.0
  Build     #1 SMP PREEMPT_DYNAMIC Debian 6.12.48-1 (2025-09-20)
  Work      in the 3 days, 4 h since boot: 912.3 million context switches
            (3,330 per second), 1.2 million processes started, 51.2 million
            interrupts
  Now       3 tasks running or ready, 1 waiting on I/O
  Disk FS   ext4, vfat, btrfs

An example: Alice's laptop, one of the test machines. In your terminal, this block shows your own machine, read live.

Pitfalls

Deep dive 2 questions

What does the VFS keep in common?

The objects every filesystem must provide: superblocks (a mounted filesystem), inodes (files), dentries (names in folders) and open file structures, each with a table of operations the filesystem fills in. The VFS handles path lookup, permissions, the page cache and caching of names and inodes once, for all of them.

How do VMs and containers share folders with the host?

virtiofs and 9p carry file operations between a guest and its host over virtio. virtiofs is newer, much faster, and can share the host's page cache. Docker Desktop and OrbStack mount the Mac's folders this way.

Commands
findmnt mount
Paths
/proc/filesystems
See also
14. Disk
13.3 /proc and /sys
29.5 Copying files over SSH: scp, sftp and rsync
9.1 How a filesystem stores a file