Filesystem vs Block
Two PVCs ask for identical disks, yet one container finds a ready directory and the other gets a bare device with no filesystem on it. What makes the difference, and can that be changed later on?
Play the animation 6 steps, animated, plays on a computer or a tablet
Filesystem vs Block, step by step
-
Two claims ask for the same 20Gi from the same StorageClass, and each binds its own blank disk. Only one field differs: volumeMode is Filesystem for web-0, which is also what an absent field means, and Block for db-0.
Play from step 1 -
Pod web-0 is scheduled to Node-1, and the CSI node service stages its volume first. The device has no filesystem yet, so mkfs runs here and creates one, of the fsType set on the volume or else the driver default, often ext4. A disk that already holds a filesystem is left as it is.
Play from step 2 -
Still staging, the CSI node service mounts the new filesystem at a staging path on Node-1, once for the whole Node. Every Pod there that uses this volume is served from that one mount. A driver without the stage capability skips staging and formats and mounts per Pod at publish.
Play from step 3 -
Then the node service publishes the volume into Pod web-0 with a bind mount, and the container finds an ordinary directory at the mountPath from its volumeMounts, /data. Files, permissions, subPath and the fsGroup ownership change all have something to act on here, because there is a filesystem.
Play from step 4 -
Pod db-0 lands on the same Node and meets the same CSI node service, but Block skips both of those steps: no mkfs and no filesystem mount. The device itself is published into the container at the devicePath from volumeDevices, /dev/xvda, exactly as the backend delivered it.
Play from step 5 -
Pod db-0 skips Format and Mount, gets the bare device and manages its own layout, with no filesystem for fsGroup, subPath or file permissions to act on. The volumeMode field is fixed once the claim exists and must match the volume, so it is chosen up front.
Play from step 6