Cloning a PVC
PVC cloning creates a new PersistentVolumeClaim (PVC) with a copy of the data in an existing PVC. Use a clone when an application needs an independent writable copy of data, for example, to prepare a test environment from existing application data.
A clone is created directly from a source PVC. In contrast, a volume snapshot captures the PVC at a point in time and can be retained or used later to create a PVC. Choose a clone for a direct copy and a volume snapshot when you need a recoverable point-in-time copy.
ACP does not currently provide a UI for cloning PVCs. Create the cloned PVC by applying a YAML manifest with kubectl.
Prerequisites
- PVC cloning is available only for dynamically provisioned PVCs whose CSI driver supports cloning. Static provisioning does not support PVC cloning.
- The source PVC is in the
Boundphase and is not in use. - The source and target PVCs are in the same namespace.
- The target PVC requests storage capacity that is at least the source PVC capacity.
- The source and target PVCs use the same volume mode. The target access mode must be supported by its storage class and CSI driver.
ACP storage support
The target PVC can use a different storage class only when the CSI driver and storage backend support cloning from the source volume to that storage class. Kubernetes does not validate this backend compatibility.
For information about creating a source PVC, see Creating PVCs.
Create a cloned PVC
Create a manifest named clone-pvc.yaml. Replace the namespace, storage class, access mode, volume mode, capacity, and PVC names with values supported by your storage driver. See ACP storage support before choosing a target storage class.
Apply the manifest:
Verify the clone
Check the status of the target PVC:
When the STATUS column shows Bound, the storage driver has provisioned and bound the cloned volume. You can then mount cloned-pvc in a workload and verify that the expected source data is available.
Inspect the PVC events for provisioning or cloning errors:
If the PVC remains in Pending or creation fails, review the events shown by this command. Confirm that the selected storage class supports PVC cloning and that the source PVC, namespace, requested capacity, volume mode, and access mode meet the prerequisites.