Smart-cloning is a built-in feature of OpenShift Container Platform Storage (OCS), designed to enhance performance of the cloning process. Clones created with smart-cloning are faster and more efficient than host-assisted cloning.

You do not need to perform any action to enable smart-cloning, but you need to ensure your storage environment is compatible with smart-cloning to use this feature.

When you create a data volume with a persistent volume claim (PVC) source, you automatically initiate the cloning process. You always receive a clone of the data volume, if your environment supports smart-cloning or not. However, you will only receive the performance benefits of smart cloning if you storage provider supports smart-cloning.

Understanding smart-cloning

When a data volume is smart-cloned, the following occurs:

  1. A snapshot of the source persistent volume claim (PVC) is created.

  2. A PVC is created from the snapshot.

  3. The snapshot is deleted.

Cloning a data volume


For smart-cloning to occur, the following conditions are required.

  • Your storage provider must support snapshots.

  • The source and target PVCs must be defined to the same namespace.

  • The source and target PVCs must be defined to the same storage class.

  • The VolumeSnapshotClass object must reference the storage class defined to both the source and target PVCs.

If any of these prerequisites are not met, host-assisted cloning automatically occurs when you create a data volume with a PVC source.


To initiate cloning of a data volume:

  1. Create a YAML file for a DataVolume object that specifies the name of the new data volume, the name and namespace of the source PVC, and the size of the new data volume. This example clones a source PVC in block mode, so volumeMode: Block is used:

    apiVersion: cdi.kubevirt.io/v1beta1
    kind: DataVolume
      name: <cloner-datavolume> (1)
          namespace: "<source-namespace>" (2)
          name: "<my-favorite-vm-disk>" (3)
          - ReadWriteMany
            storage: <2Gi> (4)
        volumeMode: Block (5)
    1 The name of the new data volume.
    2 The namespace where the source PVC exists.
    3 The name of the source PVC.
    4 The size of the new data volume. You must allocate enough space, or the cloning operation fails. The size must be the same as or larger than the source PVC.
    5 Specifies that the destination is a block PV.
  2. Start cloning the PVC by creating the data volume:

    $ oc create -f <cloner-datavolume>.yaml

    Data volumes prevent a virtual machine from starting before the PVC is prepared, so you can create a virtual machine that references the new data volume while the PVC clones.

Additional resources