Course contentsShow
← Cloud and Infrastructure
Lesson 1295 of 2,98926. Kubernetes StorageFree lesson

Volume Modes: Filesystem vs Block

Understanding filesystem and block volume modes for different application storage requirements.

Volume Modes: Filesystem vs Block

What you'll learn: How Kubernetes volumes can be presented to pods in two different modes—filesystem or block—and when to use each.

The Two Ways to Present Storage

When you attach storage to a pod, Kubernetes gives you two options for how that storage appears inside the container: as a filesystem (the default) or as a raw block device.

Filesystem Mode (volumeMode: Filesystem)

This is what you're probably used to. The storage volume gets formatted with a filesystem (like ext4 or xfs) and mounted at a specific path inside your container. Your application reads and writes files normally using standard file operations.

Think of it like: A USB drive that's already formatted—you plug it in, and your computer shows you folders and files you can work with immediately.

Block Mode (volumeMode: Block)

Here, the storage appears as a raw block device (like /dev/sda) without any filesystem. Your application talks directly to the raw storage device using special I/O operations. This is for specialized applications that need complete control over how data is written to disk.

Think of it like: An unformatted hard drive—advanced users can write data directly to specific sectors without the overhead of a filesystem layer.

When to Use Each

Use Filesystem mode (default) for:

  • Most applications that work with files and directories
  • Databases that manage files (like SQLite)
  • Web servers serving static content

Use Block mode for:

  • High-performance databases that implement their own storage management (like certain enterprise databases)
  • Applications requiring direct disk I/O control
  • Scenarios where filesystem overhead would hurt performance

Key Takeaway: Filesystem mode presents storage as a mounted directory (most common), while block mode exposes raw storage devices for applications needing direct, low-level disk access—choose based on your application's storage interface requirements.