Skip to content
AITroveRead. Build. Understand.
Make this comfortable

Raw block PVCs: make the application's formatting responsibility explicit

Last updated: 5 Oct 20266 min read
tutorial
AdvancedBy AITrove Editorial

A Filesystem PVC presents a mounted filesystem to the container. A Block PVC presents an unformatted block device through a volume device path. The latter can avoid a filesystem layer for software that manages its own storage layout, but it also transfers formatting, corruption detection, and recovery responsibility to that application. The PVC and PV volume modes must match during binding; changing a claim to Block is not a safe shortcut for improving a filesystem workload's throughput.

Operational decision

A ledger engine can manage its own page layout. In an isolated cluster with a CSI driver that supports raw block, request a Block claim and map it to the container's device path as shown below. Verify the engine refuses to initialize a device with unexpected existing data, writes a recognizable generation marker, and can reopen it after a Pod restart. Test a mismatched filesystem-mode claim and confirm it does not silently bind as a raw device. Before every restore, check the backup format, device size, block alignment, and application version; copying a filesystem snapshot onto an application-formatted block device may not produce a usable ledger. Restrict device access to the intended Pod and retain a recovery copy before any initialization that could overwrite bytes. The sample is only a claim; the consuming Pod must use volumeDevices rather than volumeMounts.

yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: receipt-ledger-block
  namespace: checkout
spec:
  volumeMode: Block
  accessModes:
    - ReadWriteOncePod
  storageClassName: receipt-csi-retain
  resources:
    requests:
      storage: 63Gi

Cost and verification

Raw block can reduce one layer of overhead, but it increases the cost of application-specific formatting and recovery tests. It does not guarantee higher throughput; provider IOPS limits, queue depth, and write pattern may dominate. Measure sustained latency and recovery time against a filesystem baseline before choosing the mode. Capacity billing remains tied to provisioned storage, and a 63 GiB device may need internal metadata reserve that the application must account for.

Common Mistakes

  • Do not mount a Block claim as though it were a filesystem path.
  • Do not initialize a raw device without proving which volume ID it is.
  • Do not assume a filesystem snapshot restores an application-managed block layout.

Connected lessons

Practice and check

Advanced follow-up

devops
operations
Storage details