Reclaiming space on target volumes

Reclaim the actual available storage space on target volumes.

You can access the actual available space using the reclaim space operation on a target volume. The reclaim operation removes the ambiguity with the available storage space when a file or data is deleted on the persistent volume and this operation is available for the Ceph RBD. Since the object still remains on the RBD device and the storage is not released to the Ceph cluster, this gives an incorrect information of the actual available storage space.

Reclaim space operation triggers rbd sparsify on the RBD device, which in turn reclaims the space for zeroed image extents. For filesystem mode, fstrim is also performed on the filesystem mounted on the block device. When fstrim is enabled on the filesystem then you can create a PVC with ReadWriteOnce (RWO) access that is based on the Ceph RBD with the following mode:

  • Volume mode Block
  • Volume mode Filesystem
Note: For newly installed clusters the reclaim space operation is enabled by default.
To enable the reclaim space operation for upgraded clusters, set CSI_ENABLE_CSIADDONS: "true" in the rook-ceph-operator-override configmap in openshift-storage namespace.
oc patch cm rook-ceph-operator-config -n openshift-storage -p $'data:\n "CSI_ENABLE_CSIADDONS": "true"'

You can use any one of the following three methods to reclaim the space:

  • Enabling reclaim space operation using ReclaimSpaceJob.
  • Enabling reclaim space operation using ReclaimSpaceCronJob.
  • Enabling reclaim space operation using Annotating Counterclaims. (IBM recommends using this method for enabling reclaim space operation.)