Skip to main content
Version: 4.5.x

Thin Provisioning

By default, Local PV Rawfile creates thick-provisioned volumes - the backing file is fully pre-allocated at creation time. Thin provisioning uses sparse files instead, so only the blocks actually written by the application consume physical disk space.

Thick vs Thin Provisioning

FeatureThick (default)Thin
Backing filePre-allocatedSparse (holes represent unwritten blocks)
Disk usage at creationEqual to requested sizeNear zero
OverprovisioningNot possiblePossible
PerformancePredictable - no allocation latencyMay have small latency on first write to a block
RiskNone - space is reservedOut-of-space if physical disk fills before logical limit

Enable Thin Provisioning

Set thinProvision: "true" in the StorageClass parameters:

apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: rawfile-thin
provisioner: rawfile.csi.openebs.io
volumeBindingMode: WaitForFirstConsumer
reclaimPolicy: Delete
allowVolumeExpansion: true
parameters:
csi.storage.k8s.io/fstype: ext4
thinProvision: "true"

All PVCs created from this StorageClass will use sparse files.

Overprovisioning

Thin provisioning enables you to provision more logical capacity than physical disk space. For example, on a 100 GB pool you could provision ten 20 GB volumes (200 GB logical), as long as the total data written across all volumes does not exceed the physical pool capacity.

Monitor the overcommit ratio:

rawfile_pool_volumes_logical_bytes / rawfile_pool_capacity_bytes
warning

If the underlying pool runs out of physical space, writes to thin-provisioned volumes will fail with I/O errors at the application level. Monitor rawfile_pool_remaining_capacity_bytes and set alerts before this occurs.

Monitor Physical vs Logical Usage

# Physical bytes actually written across all volumes in a pool
rawfile_pool_volumes_physical_bytes

# Logical (provisioned) bytes across all volumes
rawfile_pool_volumes_logical_bytes

# Space savings ratio (higher = more savings from thin provisioning or CoW)
1 - (rawfile_pool_volumes_physical_bytes / rawfile_pool_volumes_logical_bytes)

Per-volume physical usage:

rawfile_volume_physical_bytes

Thin Provisioning with CoW Pools

Thin provisioning combines well with Copy-on-Write pools (filesystems with reflink enabled):

  • New volumes start near-empty (sparse file).
  • Snapshots and clones only consume the blocks that differ from their source.
  • Physical usage tracks actual data written, not logical size.

Thick Provisioning Use Cases

Use thick provisioning (the default) when:

  • Predictable I/O performance is critical.
  • You need a guaranteed reservation of disk space for a workload.
  • The pool is shared with other services and you want to avoid unexpected out-of-space conditions.

Support

If you encounter issues or have a question, file a Github issue, or talk to us on the #openebs channel on the Kubernetes Slack server.

See Also