Using Volume Snapshots
A volume snapshot is a point-in-time copy of a persistent volume claim (PVC) that can be used to configure new persistent volume claims (pre-filling with snapshot data) or to roll back existing persistent volume claims to a previous state, achieving the effect of backing up application data and restoring it as needed, thereby ensuring the reliability of application data.
TOC
Prerequisites
-
The administrator has deployed the volume snapshot component Snapshot Controller for the current cluster and enabled snapshot-related features in the storage cluster.
-
The persistent volume claim must be created dynamically and its status must be Bound.
-
The storage class bound to the persistent volume claim must support snapshot functionality, such as CephRBD Built-in Storage, CephFS Built-in Storage, or TopoLVM.
Example VolumeSnapshot custom resource (CR)
This creates a snapshot of the example-pvc PVC using a CSI snapshot class.
Creating Volume Snapshots by using th web console
Creating a Volume Snapshot Based on a Specified Persistent Volume Claim (PVC)
Method One
-
Enter the Container Platform.
-
In the left navigation bar, click Storage > Persistent Volume Claims (PVC).
-
Click the ⋮ next to the corresponding persistent volume claim in the list and select Create Volume Snapshot.
-
Fill in the snapshot description. This description can help you record the current state of the persistent volume, such as Before Application Upgrade.
-
Click Create. The time taken for the snapshot depends on network conditions and data volume; please be patient.
When the snapshot changes to
Availablestatus, it indicates that the creation was successful.
Method Two
-
Enter the Container Platform.
-
In the left navigation bar, click Storage > Persistent Volume Claims (PVC).
-
Click on the name of the persistent volume claim in the list.
-
Switch to the Volume Snapshots tab.
-
Click Create Volume Snapshot, and configure the relevant parameters as needed.
-
Click Create. The time taken for the snapshot depends on network conditions and data volume; please be patient.
When the snapshot changes to
Availablestatus, it indicates that the creation was successful.
Creating Volume Snapshots in a Custom Way
-
Enter the Container Platform.
-
In the left navigation bar, click Storage > Volume Snapshots.
-
Click Create Volume Snapshot, and configure the relevant parameters as needed.
-
Click Create. The time taken for the snapshot depends on network conditions and data volume; please be patient.
When the snapshot changes to
Availablestatus, it indicates that the creation was successful.
Creating Volume Snapshots by using the CLI
Creating Persistent Volume Claims from Volume Snapshots
Currently, the platform only supports creating volume snapshots using PVCs created from storage classes with Dynamic Provisioning. You can create new PVCs based on that snapshot and bind them.
Note: The access modes supported when creating a PVC from a snapshot differ from those supported when creating a PVC from a storage class, as highlighted in bold in the table.
Method One
-
Enter the Container Platform.
-
In the left navigation bar, click Storage > Persistent Volume Claims (PVC).
-
Click on the name of the persistent volume claim in the list.
-
Switch to the Volume Snapshots tab.
-
Click the ⋮ next to the corresponding volume snapshot in the list and select Create Persistent Volume Claim, configuring the relevant parameters.
-
Click Create.
Method Two
-
Enter the Container Platform.
-
In the left navigation bar, click Storage > Volume Snapshots.
-
Click the ⋮ next to the corresponding volume snapshot in the list and select Create Persistent Volume Claim, configuring the relevant parameters.
-
Click Create.