Volume Snapshots
Explore this Page
- Overview
- Requirements
- Creating a Volume Snapshot
- Listing Snapshots
- Deleting a Snapshot
- Filesystem Consistent Snapshots
- Benefits of Volume Snapshots
Overview
Volume Snapshots enable point-in-time, consistent copies of persistent volumes managed by Replicated PV Mayastor. These snapshots play a crucial role in data protection, recovery, and portability strategies in Kubernetes environments. Leveraging a copy-on-write (COW) approach, DataCore Puls8 supports industry-standard snapshot capabilities that track changes at the block level to ensure efficient storage utilization.
DataCore Puls8 supports incremental snapshots, facilitating optimized backup and migration across heterogeneous cloud and data center infrastructures. All snapshot operations are seamlessly performed using native Kubernetes tools such as kubectl, providing a familiar experience for Kubernetes users.
Typical use cases include:
- Backup and disaster recovery
- Troubleshooting using cloned volumes
- Development and testing against read-only data copies
Snapshots are:
- Consistent: Data remains consistent across all volume replicas.
- Immutable: Once created, snapshot data cannot be altered.
Snapshots are not reconstructable in the event of node failure, unlike volume replicas.
This feature is currently supported exclusively for Local PV ZFS.
Requirements
Before using Volume Snapshots, ensure the following requirements are met:
- DataCore Puls8 with Replicated PV Mayastor is installed and configured.
- DiskPools are created and operational.
- A PVC is deployed using a compatible StorageClass.
Creating a StorageClass
cat <<EOF | kubectl create -f -
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: mayastor-3
parameters:
protocol: nvmf
repl: "3"
provisioner: io.openebs.csi-mayastor
EOF
Create and Verify a PVC
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
ms-volume-claim Bound pvc-fe1a5a16-ef70-4775-9eac-2f9c67b3cd5b 1Gi RWO mayastor-3 15s
Copy the PVC name (ms-volume-claim in this case) for later use.
Ensure an application is deployed using the created PVC, as described in the Deploy an Application documentation.
Creating a Volume Snapshot
Snapshots can be created either with an active application or directly from the PVC.
-
Define the VolumeSnapshotClass.
CopyCreate a default VolumeSnapshotClass for Replicated PV Mayastorcat <<EOF | kubectl create -f -
kind: VolumeSnapshotClass
apiVersion: snapshot.storage.k8s.io/v1
metadata:
name: csi-mayastor-snapshotclass
annotations:
snapshot.storage.kubernetes.io/is-default-class: "true"
driver: io.openebs.csi-mayastor
deletionPolicy: Delete
EOFAlternatively, apply using a YAML file:
-
Create the Snapshot.
CopyCreate a VolumeSnapshot from an existing PVCcat <<EOF | kubectl create -f -
apiVersion: snapshot.storage.k8s.io/v1
kind: VolumeSnapshot
metadata:
name: mayastor-pvc-snap
spec:
volumeSnapshotClassName: csi-mayastor-snapshotclass
source:
persistentVolumeClaimName: ms-volume-claim
EOFSnapshots on thick-provisioned volumes are automatically converted to thin-provisioned volumes.
Listing Snapshots
Use the following commands to view snapshot and snapshot content details.
NAME READYTOUSE SOURCEPVC SOURCESNAPSHOTCONTENT RESTORESIZE SNAPSHOTCLASS SNAPSHOTCONTENT CREATIONTIME AGE
mayastor-pvc-snap true ms-volume-claim 1Gi csi-mayastor-snapshotclass snapcontent-174d9cd9-dfb2-4e53-9b56-0f3f783518df 57s 57s
NAME READYTOUSE RESTORESIZE DELETIONPOLICY DRIVER VOLUMESNAPSHOTCLASS VOLUMESNAPSHOT VOLUMESNAPSHOTNAMESPACE AGE
snapcontent-174d9cd9-dfb2-4e53-9b56-0f3f783518df true 1073741824 Delete io.openebs.csi-mayastor csi-mayastor-snapshotclass mayastor-pvc-snap default 87s
Deleting a Snapshot
Use the following commands to delete a snapshot.
Filesystem Consistent Snapshots
DataCore Puls8 supports filesystem-consistent snapshots by default. This ensures data integrity by quiescing active I/O operations using the FIFREEZE and FITHAW ioctls during snapshot creation.
If the filesystem quiescing process fails, the entire snapshot operation is retried automatically by the Mayastor CSI controller.
Disabling Filesystem Consistency
To disable filesystem quiescing, modify the VolumeSnapshotClass as follows:
kind: VolumeSnapshotClass
apiVersion: snapshot.storage.k8s.io/v1
metadata:
name: csi-mayastor-snapshotclass
annotations:
snapshot.storage.kubernetes.io/is-default-class: "true"
parameters:
quiesceFs: none
driver: io.openebs.csi-mayastor
deletionPolicy: Delete
Snapshot Space Requirement
When creating snapshots for an existing volume, each replica pool must have sufficient free space relative to the volume size. The minimum required free space is governed by the following configuration parameter:
openebs.mayastor.agents.core.capacity.thin.snapshotCommitment
This parameter specifies the required free space as a percentage of the volume size.
Example:
If the value is set to 40, and a pool has 40 GiB of free space, then the maximum volume size allowed for snapshot creation on that pool is 100 GiB.
Adjusting this parameter ensures that snapshots do not exceed the pool’s storage capacity, helping to maintain system stability and avoid failures during snapshot operations.
Benefits of Volume Snapshots
- Enables point-in-time backup for critical applications.
- Facilitates fast and reliable disaster recovery.
- Minimizes downtime by enabling quick volume restores.
- Simplifies data migration across environments or clusters.
Learn More