Raw Block Volumes in Kubernetes
What happens when you give a container a bare disk instead of a tidy folder, why some of the world's most demanding software asks for exactly that, and how to use it safely.
Imagine renting a storage unit. In the usual deal, the building owner has already installed shelves, labelled the boxes, and given you a catalogue that says what is on which shelf. You just say “put this on shelf 12” and it happens. That is convenient, and almost everyone wants it. Now imagine a customer who is a professional archivist. They have their own filing system, their own labels, even their own shelving. For them the owner’s shelves are in the way. They would like the empty room, with four walls and a floor, and they will arrange everything themselves.
Kubernetes can offer both kinds of storage unit. The ready-shelved version is called a filesystem volume, and it is the default. The empty room is called a raw block volume. In this guide you will learn what a block device and a filesystem really are, how Kubernetes hands a raw device to a container, which applications benefit, how binding, snapshots, resizing and access modes behave, and what you give up in exchange for the extra control. Every new term is explained the first time it appears, so you can start from zero.
1Why Storage Comes in Two Shapes
To understand raw block volumes, we first need to see what normally sits between your program and a disk.
A disk is just a long row of numbered boxes
Deep down, a storage disk, whether it is a spinning drive, a flash drive, or a cloud volume, knows nothing about files or folders. It is a very long row of equally sized slots called blocks, usually 512 bytes or 4,096 bytes each. You can say “read block 7,000,001” or “write these bytes into block 42”, and that is all the disk understands. Anything you can do with such a raw disk is done by reading and writing numbered blocks. A disk used this way is called a block device.
The filesystem: a librarian for the blocks
Nobody wants to remember that “my photo lives in blocks 800 through 1,200”. So operating systems put a layer on top, called a filesystem. Common ones include ext4 and XFS on Linux. A filesystem is like a librarian with a catalogue. It keeps track of which blocks belong to which file, organizes files into folders, remembers who owns what, and protects against half-finished writes using a journal. Your programs then simply ask for “/data/report.csv”, and the filesystem translates that into block numbers.
By default, when a Kubernetes Pod asks for storage, the cluster takes a raw disk, creates a filesystem on it if one does not exist yet, and mounts it at a folder path inside your container. You never see the blocks. This is the Filesystem volume mode, and it is right for the vast majority of applications.
Think of a huge warehouse floor marked with numbered squares (the blocks). A filesystem is the warehouse manager who keeps a ledger: “Customer A’s boxes are in squares 5, 6 and 90.” You ask for “Customer A’s boxes” and the manager fetches them. Raw block mode removes the manager and hands you the whole warehouse floor with only the square numbers. You are now the manager.
Why anyone would give up the librarian
Some software already keeps its own catalogue. A database, for example, often has a carefully designed on-disk layout, its own caching, and its own method of making sure writes survive a crash. When such software sits on top of a filesystem, the work is partly duplicated: the filesystem keeps a journal, the database keeps a log, both cache the same data in memory, and each adds its own small delays. Handing the database the raw disk lets it skip the middle layer.
Other uses are different. A virtual machine running inside Kubernetes expects a whole disk to install its own operating system on. A storage system that is itself built on Kubernetes, such as a software-defined cluster of disks, wants to own the disks directly. A backup or data-copy tool may want to read every block exactly as it is. For all of these, a raw device is the natural form.
Filesystem-only volumes
Early Kubernetes always put a filesystem on every volume and mounted it into the container.
Raw block arrives as an experiment
Users running databases and storage software asked for direct device access, and an early version appeared.
The CSI standard
The Container Storage Interface gave drivers a common way to describe both mounted and block access.
Stable support
Raw block volumes became generally available, with support across the main drivers and with features like snapshots.
The virtualization and storage era
Virtual machines on Kubernetes and storage platforms running on Kubernetes made block mode a mainstream tool.
Raw block mode is not a faster version of the normal mode. It is a different contract: you receive a bare device, and everything above it becomes your application’s job. For most programs, the normal filesystem mode is both easier and just as fast.
2Core Concepts: The Vocabulary You Need
A dozen words appear again and again in Kubernetes storage. Learn them once and the rest of the guide reads easily.
| Term | What it means | Everyday picture |
|---|---|---|
| Block device | A disk seen as a numbered row of fixed-size blocks. | An empty warehouse floor with numbered squares. |
| Filesystem | The layer that turns blocks into files and folders. | The manager with the ledger. |
| Volume | Storage made available to a Pod. | A storage unit assigned to a tenant. |
| PersistentVolume (PV) | A piece of real storage registered in the cluster. | A unit in the warehouse. |
| PersistentVolumeClaim (PVC) | A request for storage made by a user or application. | A rental request form. |
| StorageClass | A named recipe describing what kind of storage to create on demand. | A menu: “fast flash” or “cheap bulk”. |
| volumeMode | Whether a volume is used as a Filesystem or as a raw Block device. | Shelved room versus empty room. |
| CSI driver | The plug-in that lets Kubernetes talk to a storage system. | A translator for each storage vendor. |
| Attach | Connecting a disk to a particular node. | Delivering the unit to the right building. |
| Mount versus map | Mount puts a filesystem at a folder. Map exposes a device file with no filesystem. | Opening a catalogued cabinet versus handing over the bare key. |
| Access mode | Rules for how many nodes or Pods may use the volume at once. | “One tenant at a time” or “shared access”. |
| Reclaim policy | What happens to the disk when the claim is deleted: Delete or Retain. | Scrap the unit, or keep it locked. |
The two volume modes side by side
Every PersistentVolume and every PersistentVolumeClaim has a field called volumeMode. It can be Filesystem, which is the default if you say nothing, or Block. With Filesystem, Kubernetes prepares a directory for your container. With Block, Kubernetes places a device file, a special entry such as /dev/xvda, inside the container. Reading from that file reads raw blocks. Writing to it writes raw blocks. There is nothing else on it unless you put something there.
An Amazon EBS volume is itself a block device, in both modes. The words “block storage” describe what the cloud sells. “Raw block mode” is a Kubernetes choice about whether to put a filesystem on it before use. A cloud disk can be used in Filesystem mode (the default) or in Block mode; the disk is the same.
A blank notebook can be used as it comes, or you can first rule it with lines, columns and page numbers. Filesystem mode is the ruled notebook; Block mode is the blank one. The notebook itself is identical in both cases. The only question is whether you want someone else to have ruled it for you.
3Architecture: The Parts That Deliver a Raw Disk
A raw block volume uses the same storage machinery as any other volume. Only the last step differs.
flowchart LR
U["User creates PVC with volumeMode Block"] --> SC["StorageClass picks the CSI driver"]
SC --> PR["CSI controller creates the disk"]
PR --> PV["PersistentVolume with volumeMode Block"]
PV --> BIND["PVC and PV bound"]
BIND --> ATT["Attach disk to the chosen node"]
ATT --> MAP["Kubelet maps the device, no filesystem mount"]
MAP --> CT["Container sees a device file at devicePath"]
Read the diagram from left to right. A user files a request, the PVC, and states that they want the Block mode. A StorageClass tells Kubernetes which driver to use and with what settings. The driver’s controller part creates a real disk in the storage system and registers it as a PersistentVolume. Kubernetes binds the PVC to the PV. When a Pod using the claim is scheduled, the disk is attached to the node, and finally the kubelet exposes the device inside the container. Up to the last step the process is the same as for any volume.
PersistentVolumeClaim
States the size, the access mode, the StorageClass and the volume mode. The mode on the claim must match the mode on the volume it binds to.
StorageClass
Names the driver and its settings, such as disk type or encryption. It also sets when the disk is created and what happens when the claim is removed.
CSI controller
Runs in the cluster and talks to the storage system’s API to create, attach, snapshot and resize disks.
CSI node plugin
Runs on every node and prepares the device for the Pod. In Block mode it exposes the device without creating a filesystem.
Kubelet volume manager
The node agent that decides what must be attached, mapped or mounted for each Pod, and cleans up afterwards.
Container runtime
Receives the device path from the kubelet and makes it visible inside the container with the right access rules.
The CSI contract: two kinds of access
The Container Storage Interface, or CSI, is the standard that lets storage vendors write one driver that works with every container platform. Part of the standard describes the type of access a volume is wanted for: either mount, meaning a filesystem, or block, meaning a raw device. When Kubernetes asks the driver to publish a volume on a node, it states which one. A driver that supports block mode is able to hand over a device file in place of a mounted folder. A driver that does not support it will refuse, and the Pod will not start.
A delivery company will either deliver furniture fully assembled and placed in a room (mount) or deliver the crate at the front door for you to assemble (block). The company’s standard order form has a box for each choice. If a particular delivery depot only offers the assembled service, an order for the crate is rejected at the counter.
Production example: Amazon EBS on EKS
On Amazon EKS, the EBS CSI driver creates cloud disks and attaches them to worker nodes. It supports both modes. In Filesystem mode it formats the disk with a filesystem such as ext4 or XFS before use. In Block mode it hands the unformatted device to the container as is. Note that Amazon EFS and similar shared file services are filesystems by nature, so they do not offer a raw block mode at all.
4Internal Working: Two I/O Paths, and What the Kubelet Does
Looking inside shows exactly what is removed in block mode, and what stays the same.
flowchart TD
subgraph FS["Filesystem mode"]
A1["Application"] --> A2["Filesystem: files, folders, journal"]
A2 --> A3["Page cache in memory"]
A3 --> A4["Block layer and I/O scheduler"]
A4 --> A5["Disk"]
end
subgraph BL["Block mode"]
B1["Application with its own layout"] --> B4["Block layer and I/O scheduler"]
B4 --> B5["Disk"]
end
Compare the two columns. In Filesystem mode, a write passes through the filesystem, which decides which blocks to use and records the change in its journal. It often lands in the page cache, a region of memory where the system keeps recent data for speed, before the block layer finally sends it to the disk. In Block mode, the application talks straight to the block layer. There is no filesystem to consult, and the application itself decides which blocks to write and when to flush them. The block layer and the disk are identical in both cases, which is why the physical limits of the disk do not change.
What the kubelet does differently
The scheduler picks a node
The Pod is placed on a node, taking into account the volume’s location, since many cloud disks live in a single zone.
The disk is attached
The attach-detach controller asks the driver to connect the disk to that node. The operating system now sees a new device.
The kubelet waits for the device
It confirms that the device has appeared on the node before moving on.
The device is mapped, not mounted
For Filesystem mode the kubelet would format if needed and mount. For Block mode, it skips both. It only creates a device entry in the Pod’s private area on the node and, with the driver’s help, in a shared staging area.
The runtime exposes the device
The kubelet tells the container runtime to place the device at the path the Pod asked for, with permission to read and write.
The container starts
The application opens the device file and sees the raw blocks. Nothing else is on it unless the application put something there.
No formatting, ever, by Kubernetes
This is the most important rule to remember. In Block mode, Kubernetes never creates a filesystem on the device and never checks one. If the disk is new, it is blank. If it carried data from before, that data is still there. Your application must recognise whether the device is already initialised, and must never assume that a new volume has any particular content.
With the furnished storage unit, the owner sweeps and installs shelves before each new tenant. With the empty room, the owner hands you the key and does nothing else. Whatever the previous tenant left, or didn’t, is your concern. You must check the room before you trust it.
Never write an application start-up routine that “initialises the device if it looks empty” without checking very carefully. A wrong test can wipe a disk that already holds valuable data after a restart or a reattachment. Check for a proper signature or header written by your own software.
5Using a Raw Block Volume in Practice
Only a few fields change when you move from a normal volume to a raw one. Knowing exactly which ones prevents most early errors.
Step one: ask for Block in the claim
In the PersistentVolumeClaim, set volumeMode to Block. Everything else, the size, the access mode, the StorageClass, works as usual. If you leave the field out, the claim asks for a Filesystem. The claim does not mention formats, because there is no format.
Step two: use volumeDevices, not volumeMounts
In the Pod, a Filesystem volume appears under volumeMounts with a mountPath, a folder inside the container. A raw block volume appears under a different list, volumeDevices, with a devicePath, which is the location of a device file, for example /dev/appdata. The two lists are separate. A single volume name cannot appear in both. Pick the path carefully: it must not clash with a device or folder that already exists in the container, and it should sit under the device folder by convention.
| Item | Filesystem mode | Block mode |
|---|---|---|
| Claim field | volumeMode: Filesystem (default) | volumeMode: Block |
| Pod field | volumeMounts with mountPath | volumeDevices with devicePath |
| What the container sees | A folder containing files | A device file with raw blocks |
| Who formats it | Kubernetes and the driver, on first use | Nobody, unless your application does |
| Files and folders | Yes | None, unless you create a filesystem yourself |
Group ownership fix-up (fsGroup) | Applied | Not applicable |
| Usage numbers (free space) | Reported by the kubelet | Not available |
| File-level backup tools | Work | Do not work; use snapshots |
| Sub-folders of a volume | Possible with subPath | Not possible |
What the application does with the device
Inside the container, the application opens the device file the same way it opens any file, but reads and writes at block offsets. Tools commonly used for testing and inspection include lsblk to list devices, blockdev to find the size, dd to copy bytes, and fio to measure performance. A program can also create its own filesystem on the device and mount it, but that needs extra privileges and is usually a sign that Filesystem mode would have been simpler.
Before running your real application, start a small test Pod with a block claim and look at the device from inside: its size, its permissions, and whether it is blank. Ten minutes of exploring saves hours of confusion later.
Filesystem mode is a hotel room key card that opens a furnished room, and you ask for “the desk drawer”. Block mode is a key card for an empty room, and you tell the hotel exactly where in the room you want each item placed. Two different cards, two different doors, one hotel.
Production example: a database with its own storage engine
Enterprise databases that manage their own on-disk layout, such as those that use their own volume manager or storage pool, can be given a raw device and organise it entirely themselves. On Kubernetes, the claim requests Block mode, the Pod lists the device, and the database opens the path at start-up. The Kubernetes side stays small; the database owns everything above the blocks.
6Provisioning and Binding Rules
A claim only binds to a volume that matches its needs. Volume mode is one of the matching rules, and mistakes here leave claims waiting forever.
Mode must match
When Kubernetes looks for a PersistentVolume for a claim, it checks size, access mode, StorageClass and labels, and also the volume mode. A claim that asks for Block will not bind to a Filesystem volume, and the reverse is also true. If the only available volumes have the wrong mode, the claim stays Pending, and the events explain that no matching volume was found. For dynamic provisioning, the driver must be able to create a block volume, or the creation fails.
Dynamic provisioning: the usual route
In most clusters you do not create PersistentVolumes by hand. You create a claim that names a StorageClass, and the driver creates the disk on demand. For block mode, this works exactly the same way, as long as the driver supports it. The disk type, speed and encryption come from the StorageClass settings. A good habit is to create a dedicated StorageClass for block workloads, with a clear name, so nobody uses the wrong one by accident.
Static provisioning: bringing your own disk
With static provisioning, an administrator creates a PersistentVolume that points to an existing disk or network target and marks its mode as Block. This route is common for local NVMe drives on a node, for pre-created SAN volumes, and for special hardware. It gives total control but also requires care, because the disk may hold old data.
Timing: wait for the Pod
Many cloud disks exist in a single availability zone and can only attach to nodes in that zone. If the disk is created before the scheduler has chosen a node, the disk may land in a zone where the Pod cannot run. The setting volumeBindingMode: WaitForFirstConsumer on the StorageClass solves this: the disk is created only after the Pod is scheduled, in the same zone as the chosen node. This is strongly recommended for zone-bound cloud disks, in both volume modes.
| Storage backend (typical) | Raw block support | Notes |
|---|---|---|
| Cloud disks (Amazon EBS, Google Persistent Disk, Azure Disk) | Yes, through their CSI drivers | Disks are zone-bound; plan topology. |
| Local NVMe and local disks | Yes | Tied to one node; data lost if the node is lost. |
| Ceph RBD, Longhorn and similar software-defined storage | Yes | Often also supports shared block access. |
| iSCSI and Fibre Channel arrays | Yes | Used for existing SAN investments. |
| NFS, Amazon EFS, SMB, CephFS | No | These are shared file systems, not block devices. |
| Object storage (such as S3) | No | Not a block device at all. |
Always read your driver’s documentation to confirm block support, and test it. A driver that does not support block mode may either reject the claim or, in rare cases, behave in surprising ways. The table above is a general guide, not a promise for any particular version.
Booking a room before knowing which floor your meeting is on risks getting a room on the wrong side of the building. Waiting until the meeting location is confirmed, then booking the room next to it, is what WaitForFirstConsumer does for disks and Pods.
7When Raw Block Is the Right Choice
The honest answer to “should I use block mode?” is “usually not”. Here is how to tell the exceptions.
flowchart TD
S["Do I need raw block?"] --> Q1{"Does the app manage its own on disk layout?"}
Q1 -->|yes| B["Use Block mode"]
Q1 -->|no| Q2{"Is it a VM disk, Ceph OSD or similar?"}
Q2 -->|yes| B
Q2 -->|no| Q3{"Need files, folders, fsGroup or file level backup?"}
Q3 -->|yes| F["Use Filesystem mode"]
Q3 -->|no| Q4{"Measured a real filesystem overhead problem?"}
Q4 -->|yes| B
Q4 -->|no| F
Read the diagram from the top. The first two questions identify software that is built to own a raw device. The third catches everything that depends on files. The last question protects you from guessing: unless you have actually measured a filesystem problem on your own workload, the safe default is Filesystem mode.
Good reasons to choose Block
Self-managing storage engines
Databases with their own volume management and caching can use the device directly and avoid duplicated work in the filesystem and page cache.
Virtual machine disks
A virtual machine expects a whole disk. Block volumes map neatly onto it, and are the usual choice when running virtual machines on Kubernetes.
Software-defined storage
Storage systems built on Kubernetes, such as Ceph clusters, want to own raw disks, and can request them as block claims.
Direct I/O workloads
Applications that bypass caches and manage their own buffers can benefit from a shorter path, when measured and proven.
Custom filesystems or encryption
Teams that need a particular filesystem, or a layer such as disk-level encryption controlled by the application, can set it up themselves.
Block-level copy and recovery
Migration, forensic and recovery tools that read every block as it is need unprocessed access.
Poor reasons to choose Block
- “It must be faster.” Not automatically. The disk’s own speed is the same, and the kernel’s filesystem code is highly optimised. Gains appear only for particular patterns.
- “I do not want a filesystem lock-in.” Filesystem mode is portable and well supported. Block mode makes you responsible for your own formats.
- “My application just writes some files.” If it uses folders and files, it needs a filesystem. Giving it a raw device means it cannot work.
- “Everyone else uses it.” A rare mode with fewer tools should be adopted deliberately, not by imitation.
A professional kitchen may bring its own stoves and shelving into an empty hall, because it knows exactly what it needs. A family moving into a flat is better off with the kitchen the flat came with. Choosing the empty hall without a trained kitchen team is simply more work for the same dinner.
Production example: Rook and Ceph on Kubernetes
Rook, a widely used project that runs Ceph storage on Kubernetes, can create its storage daemons on top of raw block volumes requested through claims. Ceph wants whole, unformatted devices, because it manages its own data placement and replication. Running it on cloud disks as block claims lets a platform team build its own storage cluster using nothing but Kubernetes objects.
8Access Modes and Sharing a Device
A raw device is easy to damage if two writers use it without coordination. Access modes are the guardrails.
| Access mode | Meaning | Typical raw block use |
|---|---|---|
ReadWriteOnce (RWO) | Read and write by one node at a time (several Pods on that node may share it). | The common case for cloud disks and single-instance databases. |
ReadWriteOncePod (RWOP) | Read and write by exactly one Pod in the whole cluster. | Strict exclusivity for databases that must never be doubled up. |
ReadOnlyMany (ROX) | Read by many nodes, no writing. | Distributing a read-only image or data set. |
ReadWriteMany (RWX) | Read and write by many nodes at once. | Shared-disk clusters and virtual machine live migration, only on drivers that support it. |
Why sharing a raw device is dangerous
A filesystem is not just a tidy catalogue. It is also a referee. Within a single machine, it makes sure two programs do not overwrite each other’s files. Across machines, most filesystems cannot be mounted for writing in two places at once, because each machine would keep its own memory picture of the layout and corrupt it. With a raw device there is no referee at all. If two programs on two nodes both write to the same blocks, the data is quietly damaged, with no error message.
This is why RWX on a block volume is a specialised feature. It is correct only if the software on top coordinates writers itself, as clustered databases and clustered filesystems do, or if only one writer is ever active at a moment, as in the live migration of a virtual machine, where the source hands the disk to the destination in a controlled step.
Two editors working on the same printed page with red pens will make a mess unless they agree on who writes where. A shared whiteboard with an agreed rule, “I write on the left half, you write on the right half”, works fine. A clustered application is the agreement. Raw block RWX is the whiteboard, and Kubernetes does not provide the rule.
Making sure only one writer is active
- Prefer RWOP for single-writer software. It prevents the scheduler from starting a second Pod that uses the same claim, even on another node.
- Mind the node failure case. If a node stops responding, the disk stays attached to it for a while. A new Pod on another node may be blocked by a multi-attach error until the system is sure the old node has really let go.
- Use application-level fencing for shared devices. Clustered software often uses reservations on the device or a lease in a separate service so that a faulty node cannot keep writing after it was declared dead.
- Test failover with real failures. Pull the network from a node and watch what happens to the disk.
Production example: live migration of virtual machines
Projects like KubeVirt run virtual machines as Pods and store their disks as block claims. To move a running virtual machine from one node to another without shutting it down, both nodes must see the disk briefly. Storage drivers with shared block access, such as those backed by Ceph, allow this. Disks that only attach to one node cannot support live migration, and the machine must be stopped and restarted instead.
Never assume a driver supports shared block access because it supports the mode. Many cloud disk drivers support only single-node attachment. The access mode requested in a claim must be one that the driver can honour.
9Device Access, Permissions and Security Context
A device file is protected by the same permission rules as any file on Linux, and Kubernetes does not tidy them for you.
No fsGroup for raw devices
In Filesystem mode, a Pod can set fsGroup in its security context, and Kubernetes changes the group ownership of the volume’s files so that the application can write them. This works because there are files to change. With a raw device there is no such tree of files. Kubernetes cannot apply the fix-up, and the permissions of the device file itself decide who may read and write.
The practical effect is that a container running as a non-root user may find the device unreadable or unwritable. The cure depends on the platform and driver: you may need to add the user to the group that owns the device through the Pod’s supplemental groups, run the process as a specific user, or have a small privileged setup step. Check the behaviour of your driver and runtime, and test as the same user your application will use.
Do you need a privileged container?
Simply reading and writing a device handed over through volumeDevices does not require a privileged container. The container runtime adds the device to the container with permission to read and write. Privileges are needed only when you do more, such as creating a filesystem and mounting it from inside the container, or changing the device’s settings. Keep privileges as low as the task allows.
Open, read and write
Ordinary use by the application. Works for a user who has permission on the device file.
Mount a filesystem
Needs powerful capabilities. Prefer Filesystem mode if this is the goal.
Change device settings
Resizing queues, or changing scheduler options, is not for ordinary Pods.
Mount the host’s own devices
Raw access to the node’s root disk through host paths is a serious risk and is not the same as a block claim.
Stale data and clean slates
A new cloud disk starts blank. But a disk that was used by someone else and then reused, for example a statically provisioned device or a retained volume, may still hold old data. With a filesystem, a fresh format would remove it. With a raw device, nothing happens automatically. In a shared cluster this can leak one team’s data to another. Drivers and administrators should wipe or replace devices between uses, and applications should never treat unexpected content as safe.
Check ownership and permissions
Look at the device file inside a test Pod and see who owns it and what modes it has.
Run as the real user
Test with the same user and group settings your application will use in production.
Add only the needed group or capability
Use supplemental groups or narrow capabilities, rather than making the whole container privileged.
Verify the contents before use
Have your software check for its own signature and refuse unknown content.
Wipe on reuse
Make sure retained or reused devices are cleared by the platform before another tenant receives them.
When a hotel hands you a room, housekeeping has cleaned it and the key opens the door. If you rent an empty hall from a previous tenant, the hall may still have their furniture and papers in it, and the door lock may be one you have no key for. You must check both before you move in.
Pod security policies in your cluster, such as the built-in Pod Security Standards or an admission policy, can restrict privileged containers and capabilities. Plan block workloads together with your security team, so that legitimate needs are designed in rather than granted as exceptions.
10Snapshots, Clones, Backups and Resizing
Most day-two work on storage happens here. Block volumes support the main features, with a few important differences.
Snapshots
A snapshot is a frozen picture of a volume at one moment. Kubernetes exposes snapshots through objects such as VolumeSnapshot, handled by the CSI driver. For raw block volumes, a snapshot captures the blocks exactly. It does not know about files, so it cannot say anything about what is inside, and it cannot be “browsed”. It is, however, an excellent building block for backup, cloning and recovery.
It is important to understand that a snapshot of a busy device is normally crash-consistent. That means it is as if the power had been cut at that instant. A well-designed application can recover from that, like a database replaying its log. If your software needs a cleaner state, it should flush or pause before the snapshot is taken.
Restoring and cloning, and the mode rule
A snapshot or an existing claim can be used as the source for a new claim. The new claim should have the same volume mode as the source. Kubernetes and the snapshot controller take care to prevent a silent conversion, for example restoring the blocks of a raw volume into a Filesystem claim, because the result would make no sense and could be misread as a damaged filesystem. An administrator can explicitly allow a mode change for special cases, but it is an unusual step.
Backups: file tools do not work
Many popular backup tools for Kubernetes work by walking through the files of a volume and copying them. With a raw block volume there are no files to walk, so these tools cannot back it up. The right approach is snapshot-based backup, where the backup system asks the driver for a snapshot and then stores that snapshot or copies it elsewhere. If you rely on a specific backup product, check its documentation for block support before you adopt block mode.
CSI snapshots
Volume-level pictures, supported by drivers that implement the snapshot feature.
Application-level backup
The application’s own tools export or replicate data, which is often the safest method.
Replication in the storage layer
Some storage systems copy blocks to another site on their own.
File-walking backup
Tools that read through a mounted filesystem cannot read a raw device.
Expanding a volume
If the StorageClass allows volume expansion, you can edit the claim to request more space. The driver enlarges the underlying disk. In Filesystem mode, the kubelet then also grows the filesystem. In Block mode there is no filesystem, so Kubernetes does nothing more: the device simply becomes larger. Your application must notice the larger size and begin to use the new space, for example by re-reading the device size, then extending its own layout. Shrinking is not supported.
Edit the claim size upward
Request a larger size in the PVC.
The driver enlarges the disk
The storage system grows the underlying volume. Some drivers can do this while the volume is in use, others need the Pod to stop.
The node sees the new size
The device on the node reports the larger capacity, sometimes after a rescan.
The application grows into it
Your software must use the extra space. Kubernetes cannot do this for you.
Taking a larger empty hall is simple for the landlord: knock down a wall. But the tenants’ furniture plan still ends at the old wall until they redraw it. Kubernetes enlarges the room; your application must redraw its plan.
A snapshot is not a backup by itself if it lives in the same storage system as the volume. If that system fails, both are lost. Copy snapshots, or application backups, to a separate place.
11Data Flow and Lifecycle of a Block Volume
From request to retirement, a volume passes through clear stages. Knowing them helps you read events and plan clean-ups.
flowchart LR
P["PVC created"] --> PR["Provisioned"]
PR --> BD["Bound"]
BD --> AT["Attached to node"]
AT --> MP["Device mapped for Pod"]
MP --> US["In use by container"]
US --> UM["Pod stops: device unmapped"]
UM --> DT["Detached"]
DT --> RC{"Reclaim policy"}
RC -->|Delete| DEL["Disk deleted"]
RC -->|Retain| RET["Disk kept, data intact"]
| Stage | What happens | What can go wrong |
|---|---|---|
| Provisioned | The driver creates the disk and registers a volume. | Driver lacks block support; quota exceeded. |
| Bound | Claim and volume are linked, with matching mode and size. | Mode mismatch leaves the claim Pending. |
| Attached | The disk is connected to the chosen node. | Wrong zone; disk still attached elsewhere. |
| Mapped | The device is exposed to the Pod, with no filesystem step. | Device path clash; driver error on the node. |
| In use | The application reads and writes raw blocks. | Permission denied; corruption from two writers. |
| Unmapped and detached | The Pod stops and the node lets go of the device. | Slow detach after node failure. |
| Reclaimed | The disk is deleted, or kept, as the policy says. | Retained disks pile up and cost money; reused disks hold old data. |
Reclaim policy: Delete or Retain
When you delete a claim, the reclaim policy of the volume decides its fate. With Delete, the disk is destroyed along with its data. With Retain, the disk is kept, the data stays, and an administrator must clean it up or reuse it. For databases and other valuable data, Retain is a safety net against accidental deletion. For temporary or easily rebuilt data, Delete avoids forgotten disks that quietly cost money every month.
What happens when a Pod moves
If a Pod is rescheduled to another node, the system must detach the disk from the old node and attach it to the new one. With cloud disks this usually takes from several seconds to a minute or two. If the old node has failed, the system waits for a safety period, about six minutes in typical settings, before force-detaching the disk, so as to avoid two nodes writing to it. During that time the new Pod may report a multi-attach error. This is the platform protecting your data, not a fault.
When a tenant moves between buildings, the movers first unlock the old unit, load the contents, drive across town and unload them in the new one. If the old building is on fire and nobody can confirm the tenant is out, the owner waits a safe period before handing the key to someone else.
Read the Pod’s events whenever a block volume does not start. The wording tells you the stage that failed, whether it is attach, map or permissions, and it points straight to the right owner of the problem.
12Performance and Scalability
Raw block can shorten the path, but the disk’s own limits stay the same. Performance work begins with knowing where the limits are.
What block mode removes
Filesystem bookkeeping
No directory updates, no allocation tables, no journal writes. Fewer small writes for the same data.
Double caching
The page cache is bypassed when the application opens the device with direct I/O, so the same data is not held in memory twice.
Extra layers of latency
Fewer steps between the request and the disk, which helps most for small, frequent writes.
The disk’s own limits
Maximum operations per second, maximum throughput, and base latency are set by the storage, not the mode.
Where the real limits live
Cloud disks are sold with limits. On Amazon EBS, for example, a general-purpose gp3 volume comes with a baseline of 3,000 input/output operations per second and 125 megabytes per second regardless of size, which you can raise by paying more, while provisioned types such as io2 offer higher and more predictable performance. The instance itself also has an overall cap for all the disks attached to it. Choosing block mode will never push you past these ceilings. If you are hitting one, a change of volume type or instance size helps far more than a change of mode.
Block mode helps when the filesystem layer was the bottleneck, which happens with certain database patterns and very high rates of small writes. It may not help, or may even hurt, when the filesystem was doing useful work for you, such as merging small writes or caching reads. The only reliable way to know is to measure.
Measure the baseline in Filesystem mode
Use a tool like fio, with a pattern that matches your application, and record latency, operations per second and throughput.
Repeat in Block mode on the same volume type
Change only the mode. Use the same size, instance type, queue depth and block size.
Look at the tail, not just the average
The slowest one percent of requests often matters more than the average. Compare the 99th percentile latency.
Test with your application
Synthetic tests lie. Run your real software under a realistic load to confirm that the gain is visible to users.
Decide on evidence
If the gain is small, prefer the simpler Filesystem mode and its richer tooling.
Scaling limits to remember
| Limit | Why it matters |
|---|---|
| Disks per node | Each instance type allows only a certain number of attached volumes. Many block workloads on one node can reach this limit and leave Pods unschedulable. |
| Attach and detach time | Moving Pods with big volumes takes time. Failover is not instant. |
| Zone boundaries | A cloud disk lives in one zone, so a Pod can only run in that zone. |
| Throughput per instance | All disks on a node share the instance’s total storage bandwidth. |
| Queue depth | Many parallel requests are needed to reach a fast disk’s full speed; one slow thread cannot. |
| Snapshot frequency | Snapshots of busy volumes may slow performance briefly or cost extra, depending on the provider. |
Removing a toll booth from a motorway helps only if the toll booth was the jam. If the road itself has only two lanes, a faster toll booth changes little. Find the real bottleneck first, then decide whether block mode will clear it.
Benchmarks that run for only a few seconds on a freshly created cloud volume can look misleadingly good or bad. Some volumes need a warm-up period and some have burst credits that run out. Run tests long enough to see steady behaviour.
13High Availability and Reliability
A single block volume is a single copy of your data. Reliability comes from how you design around it.
What one volume does and does not protect
Cloud block storage is usually replicated inside one zone by the provider, so a single hardware fault does not lose your data. But the volume still lives in one zone. If the zone has a problem, the volume is unreachable. If the application writes bad data, every copy holds the bad data. If someone deletes the claim with a Delete policy, the disk goes too. High availability therefore needs more than one volume or more than one copy.
Provider replication
Protects against a failed drive inside the storage system. You get this without doing anything.
Application replication
Databases and storage platforms keep copies on several volumes, in several zones, and choose a new leader when one fails.
Snapshots and backups
Protect against mistakes, bad writes and deletions by letting you go back in time.
Another region or account
Protects against large outages and against loss of access to your main account.
Common failure situations
| Failure | What you see | How to cope |
|---|---|---|
| Node crashes | Pod is rescheduled, new Pod waits for the disk to detach, often a multi-attach event. | Expect a delay of several minutes for force-detach; use application replication for faster recovery. |
| Zone outage | Volumes in that zone are unreachable; Pods cannot start elsewhere with the same disk. | Keep replicas in other zones; restore from snapshots in a healthy zone. |
| Application crash mid-write | Device holds a partly written state. | Use write-ahead logs, checksums and recovery on start-up. There is no filesystem check to rescue you. |
| Accidental claim deletion | Disk is destroyed under Delete policy. | Use Retain for valuable data; protect claims from deletion; keep backups. |
| Silent corruption | Wrong data is read without any error. | Use application-level checksums and periodic verification. |
| Driver or node plugin fault | Volumes will not attach or map. | Monitor the driver Pods; keep it updated; test upgrades first. |
The missing safety net
When a computer loses power, a normal filesystem can usually repair itself on the next start, by replaying a journal or running a check. On a raw volume, that safety net is gone. Your application becomes responsible for making sure that a half-finished write can be detected and fixed. Storage engines built for raw devices do this carefully, with logs and checksums. Software that was never designed for raw access should not be pointed at one.
A building with its own caretaker tidies up after a power cut, straightening shelves and checking what fell. An empty hall has no caretaker. If the lights go out in the middle of unpacking, the tenant must have a plan for finding out which boxes were opened and which were not.
Practise recovery. Kill a node, delete a Pod forcefully, restore a snapshot into a test cluster. The first time you do these should not be during a real outage.
14Security and Compliance
Raw devices remove some layers of protection, so the remaining layers need extra care.
Who can ask for storage
Anyone who can create a claim in a namespace can request disks from any StorageClass they are allowed to use. Control this with RBAC for who can create claims, with resource quotas to limit how many disks and how much space a team can request, and with admission policies that limit which classes are allowed in which namespaces. A claim is also a cost, so these controls help with the bill as well as with security.
Encryption
- Encryption at rest. Cloud providers can encrypt disks with keys from a key management service. Enable it in the StorageClass or through account defaults. It works the same way for block and filesystem volumes because it happens below the node.
- Encryption in transit. For network storage protocols, check whether data between the node and storage is encrypted. For cloud disks this is handled inside the provider network, but you should confirm for your own platform.
- Application-level encryption. Because the application owns the device, it can encrypt data itself, giving you independent control of the keys.
- Key lifecycle. Plan for key rotation, key loss and key revocation. A disk whose key is deleted is gone for good.
The privileged parts of the system
The CSI node component runs on every node, usually with high privileges, because it must attach disks and map devices. A fault or compromise in it is serious. Install drivers only from trusted sources, keep them updated, limit who may change their configuration, and watch their logs.
Isolation between tenants
What helps
- A fresh, blank volume for every claim.
- Namespaces, quotas and policy to separate teams.
- No host path access to raw node devices for ordinary Pods.
- Audit logs on claim and volume changes.
What hurts
- Reusing retained disks without wiping them.
- Privileged Pods that can see every device on the node.
- Shared RWX devices without coordination or fencing.
- Unreviewed third-party drivers.
Compliance and audit
Regulations often require proof that data is encrypted, that access is controlled, and that deleted data is really gone. For block volumes, collect evidence at three places: the cluster, where audit logs show who created, changed and deleted claims; the cloud account, where disk settings and key use are recorded; and the application, where access is logged. Define what “deleted” means for your policy, such as destroying the disk, destroying the key, or both, and test that the process works.
A bank vault has a guard at the door, a log of everyone who enters, and a rule that boxes are emptied when a customer leaves. Storage needs the same three habits: control who may come in, record what they did, and clean up when they leave.
Do not confuse deleting a Kubernetes object with deleting data. A Retain policy leaves the disk alive, and snapshots or backups hold copies too. For privacy requests, trace every copy.
15Monitoring, Logging and Troubleshooting
Block volumes are quieter than filesystems: some of the usual dashboards are blank, so you must know where else to look.
What you lose
For Filesystem volumes, the kubelet reports used and free space and inode counts, which feed the familiar alerts about full volumes. For raw block volumes there is no filesystem to inspect, so these numbers are not available. The application is the only one who knows how much space is truly in use, so it must report this itself.
What to watch instead
Used and free space
Expose capacity and usage from the application’s own metrics and alert before it fills.
Disk I/O metrics
Operations, throughput, queue length and latency from the node’s device statistics.
Provider volume metrics
Idle time, queue depth, throttling and burst balance as published by your provider.
Claim and Pod events
Attach, map and permission failures appear as events on the Pod and claim.
CSI controller and node logs
First place to look when attaching or mapping fails.
Snapshot readiness and age
Alert when scheduled snapshots fail or are too old.
Symptoms and likely causes
| Symptom | Likely cause | What to check |
|---|---|---|
| Claim stays Pending | No class, mode mismatch, driver without block support, or waiting for the first consumer. | Claim events, class settings, driver documentation. |
| Pod stuck ContainerCreating | Attach or map failure; disk in another zone; still attached to a failed node. | Pod events such as map or attach failures; node and zone of the disk. |
| Multi-attach error | Disk still attached to another node. | Old node health; wait for detach; check access mode. |
| Permission denied on the device | Device owner and group do not match the container’s user. | Device file permissions; supplemental groups; security context. |
| Application reports unknown content | Wrong volume, reused disk with old data, or a mode confusion. | Which claim is mounted; its source and history. |
| Slow I/O | Throttling at disk or instance limits; low queue depth. | Provider metrics; instance limits; benchmark settings. |
| Expansion done but no new space | Application has not grown into the new size. | Device size on the node versus the application’s view. |
A calm troubleshooting routine
Read the claim
Check its phase, mode, class and events.
Read the volume
Check the bound volume, its mode, its node affinity and its reclaim policy.
Read the Pod events
Find which stage failed: scheduling, attach, map or start.
Read the driver logs
Look at the controller for attach issues and the node component for map issues.
Check the cloud side
Confirm the disk state, attachments and limits in the provider console.
Check inside the container
Confirm the device file exists at the configured path and has the right permissions.
If a delivery does not arrive, you check the order, the warehouse, the van and the front door, in that order. Each step either finds the problem or rules out one part of the journey. Storage troubleshooting follows the same chain.
Write down the exact event messages you see in your own cluster, with the cause and fix, in a team runbook. Wording varies between versions and drivers, and your own notes will be the fastest guide next time.
16Patterns, Anti-patterns and Best Practices
Lessons that teams usually learn the hard way, collected in one place.
Default to Filesystem, choose Block by exception
Start every workload with Filesystem mode. Move to Block only when the software needs a raw device or measurements show a clear gain. Write down the reason in the design record.
Separate classes for block and filesystem
Create clearly named StorageClasses, for example one for block workloads, so that teams pick deliberately and the intent is visible in the manifests.
Delay binding for zone-bound disks
Use wait-for-first-consumer binding, so the disk is created in the zone where the Pod is scheduled, instead of being stuck in a different zone.
Block mode for ordinary applications
Giving a raw device to software that expects files is a recipe for failures. Check that the software supports raw devices before using them.
Privileged containers just to make it work
Granting full privileges to bypass a permission error exposes every device on the node. Fix the group or capability instead.
Relying on file-level backups
Assuming that an existing backup product covers block volumes, without testing a restore, leaves you with no real backups.
Best practices checklist
- Confirm that your driver supports block mode and the access mode you need, before designing around it.
- Match the volume mode in claim and volume, especially for static volumes.
- Use RWOP for single-writer software.
- Set a Retain policy for valuable data, and a Delete policy for temporary data.
- Take snapshots on a schedule and copy them to a separate place.
- Export capacity and usage metrics from the application, since the kubelet cannot.
- Benchmark with your real workload before and after changing mode.
- Test node failure, zone failure and restore procedures regularly.
- Document who owns the device format and what the application does on start-up.
Common mistakes
- Forgetting that the device has no filesystem and trying to read files from it.
- Mixing up the Pod fields. Raw volumes use device entries, not mount entries, and the container sees a path to a device, not a folder.
- Expecting expansion to be automatic for the application as well as the disk.
- Ignoring per-node attach limits until Pods become unschedulable.
- Treating a snapshot in the same system as a complete backup.
- Skipping a wipe on reused volumes.
A pilot’s checklist is not there because pilots are careless. It is there because the same few mistakes are easy to make on a busy day. A good storage checklist works the same way: it turns hard lessons into a few quiet habits.
17Real-World and Industry Examples
Where raw block volumes show up in practice, and what each setting teaches us.
Virtual machines with KubeVirt
KubeVirt runs virtual machines as Pods inside Kubernetes. A virtual machine thinks it has a real hard disk, so its disk is naturally a block device. Platform teams use block claims, often on shared storage that supports multiple writers, so that machines can be moved between nodes while still running. The lesson: when the consumer is itself something that expects a whole disk, block mode is the natural fit.
Ceph clusters built by Rook
Rook runs Ceph on Kubernetes and can build its storage daemons on top of claims rather than on disks fixed to specific nodes. Ceph formats and manages the devices itself, so it asks for raw volumes. Platform teams can then grow storage by adding claims, instead of logging in to machines. The lesson: block claims let a storage system be managed with the same tools as the rest of the cluster.
Cloud disks through the EBS CSI driver
On Amazon EKS, the EBS CSI driver supports block mode, and teams use it for databases or engines that open the device directly. Because EBS volumes live in one zone and attach to one instance at a time in the common case, teams combine them with delayed binding, application replication across zones, and snapshots for protection. The lesson: block mode does not change the rules of the underlying disk, so the usual zone and attach rules still apply.
Local NVMe for speed
Some teams use local fast disks on nodes, exposed through local volume provisioners as raw block, for latency-sensitive databases. The data lives only on that node, so the application must replicate it elsewhere. The lesson: speed is bought at the cost of durability on one machine, and replication has to fill the gap.
Storage products such as Longhorn or Portworx
Several storage platforms for Kubernetes offer block mode as one of the supported options, alongside filesystem mode. They are chosen for features such as replication, snapshots and encryption. The lesson: support differs between products and versions, so confirm exactly what your chosen product offers before depending on it.
A journey through adoption
A typical team begins with Filesystem volumes for everything, because they are simple and well supported. After a while one workload, perhaps a database with its own storage engine or a platform for virtual machines, shows a real need for a raw device. The team adds a block StorageClass, tests a single workload, measures the effect, writes its recovery and backup procedures, and only then expands. The stable outcome is a small number of block users, each with a clear reason, rather than a cluster full of raw devices.
18Frequently Asked Questions
19Summary and Key Takeaways
Raw block volumes give a Pod an empty, unformatted device and let the application decide how to use it. They remove a layer of work, and in return they remove a layer of help: no files, no permission fix-up, no usage numbers, no file-level backups, and no automatic repair after a crash.
Used for the right software, such as virtual machines, storage platforms and engines that manage their own disks, they are simple and powerful. Used without need, they add risk. The best habit is to start with the filesystem, move to block deliberately, and prove the benefit with measurements.
Key takeaways
- Block mode hands the Pod a raw device; Kubernetes does not format or mount it, and the application owns the layout.
- Claim and volume modes must match, and the driver must support block mode and your access mode.
- Filesystem mode remains the right default; choose Block for software built to manage raw devices or when measurements show a gain.
- Use RWOP for single writers, and never share a raw device between writers that do not coordinate.
- Use CSI snapshots and application-level backup; file-walking backup tools cannot protect block volumes.
- Export capacity and health metrics from the application, because filesystem-based usage numbers are not available.
- Plan for zone limits, attach delays after node failure, and recovery with no filesystem check.