Snapshot Restore
Explore this Page
- Overview
- Restoring a Volume from a Snapshot
- Check Snapshot and Replica Availability
- Requirements
- Create a Volume Restore
- Benefits of Volume Restore
Overview
Volume snapshots are a vital feature for data protection, disaster recovery, and workload portability in Kubernetes environments. A volume snapshot captures the state of a storage volume at a specific point in time. Restoring a volume from a snapshot enables users to revert to a previously known good state or clone volumes for development and testing.
This document outlines the step-by-step procedure to restore a volume from an existing snapshot.
This feature is currently supported exclusively for Local PV ZFS and Replicated PV Mayastor.
Restoring a Volume from a Snapshot
Restoring a volume from a snapshot leverages point-in-time, consistent data copies across all volume replicas. For example, restoring a source volume with a replica count of 3 (i.e., repl=3) means snapshots must exist for all three replicas. The new volume’s replica count must be less than or equal to the number of available replica snapshots. If fewer snapshots are available, the restore process will fail or remain incomplete.
Check Snapshot and Replica Availability
Check Available Volume Replicas
Before initiating a restore, determine the number of available replicas for the source volume.
kubectl puls8 mayastor get volume-replica-topology ec4e66fd-3b33-4439-b504-d49aba53da26
ID NODE POOL STATUS CAPACITY ALLOCATED SNAPSHOTS CHILD-STATUS REASON REBUILD
5de77b1e-56cf-47c9-8fca-e6a5f316684b io-engine-1 pool-1 Online 12MiB 0 B 12MiB <none> <none> <none>
78fa3173-175b-4339-9250-47ddccb79201 io-engine-2 pool-2 Online 12MiB 0 B 12MiB <none> <none> <none>
7b4e678a-e607-40e3-afce-b3b7e99e511a io-engine-3 pool-3 Online 12MiB 8MiB 0 B <none> <none> <none>
Check Snapshot Availability Across Replicas
kubectl puls8 mayastor get volume-snapshot-topology --volume ec4e66fd-3b33-4439-b504-d49aba53da26
SNAPSHOT-ID ID POOL SNAPSHOT_STATUS SIZE ALLOCATED_SIZE SOURCE
25823425-41fa-434a-9efd-a356b70b5d7c cb8d200b-c7d8-4ccd-bb62-78f903e444e4 pool-2 Online 12582912 12582912 78fa3173-175b-4339-9250-47ddccb79201
b09f4097-85fa-41c9-a2f8-56198641258d pool-1 Online 12582912 12582912 5de77b1e-56cf-47c9-8fca-e6a5f316684b
25823425-41fa-434a-9efd-a356b70b5d7d 1b69b3ca-8f08-4889-8f90-1a428e088c46 pool-2 Online 12582912 0 78fa3173-175b-4339-9250-47ddccb79201
1837b17a-9773-437c-b926-dda3272e3c60 pool-1 Online 12582912 0 5de77b1e-56cf-47c9-8fca-e6a5f316684b
1f8827e7-9674-4879-8f29-b15752aef902 pool-3 Online 12582912 8388608 7b4e678a-e607-40e3-afce-b3b7e99e511a
Requirements
Before proceeding, ensure the following requirements are met:
- A volume snapshot has already been created.
- A compatible StorageClass is available for the restore operation.
- Ensure a snapshot has been created for the source volume. Refer to the Volume Snapshots documentation for detailed instructions.
Create a Volume Restore
Use the following command to create a new PVC that restores from the snapshot.
cat <<EOF | kubectl create -f -
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: restore-pvc # Name of the new PVC to be created from a snapshot
spec:
storageClassName: mayastor-3-restore # StorageClass used for restoration
dataSource:
name: mayastor-pvc-snap # Name of the VolumeSnapshot to restore from
kind: VolumeSnapshot
apiGroup: snapshot.storage.k8s.io
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
EOF
After this PVC is created, DataCore Puls8 provisions a new volume that replicates the state and content of the source volume at the moment the snapshot was taken.
A new volume, identical in data and configuration to the original at the time of the snapshot, will be created and available for use. You can now mount it to a pod and begin consuming it like any other persistent volume.
Benefits of Volume Restore
- Quick Recovery: Rapidly restore application state after data loss or corruption..
- Disaster Recovery: Strengthen your backup and recovery strategies with consistent, replica-aware snapshots.
- Reduced Downtime: Minimize service interruptions by speeding up volume replacement or rollback.
Learn More