Mayastor User Reference
version/2.4
version/2.4
  • Welcome to Mayastor!
  • Scope
  • Basic Architecture
  • Quickstart
    • Prerequisites
    • Preparing the Cluster
    • Deploy Mayastor
    • Configure Mayastor
      • Storage Class Parameters
    • Deploy a Test Application
  • Advanced Operations
    • Mayastor Kubectl Plugin
    • High Availability
    • Replica Rebuilds
    • Supportability
    • Monitoring
    • Node Cordon
    • Node Drain
    • Volume Snapshots
    • Volume Restore from Snapshot
  • Additional Information
    • Upgrade
      • Legacy Upgrade Support
    • Tips and Tricks
    • Performance Tips
    • I/O Path Description
    • Replica Operations
    • Call-home Metrics
    • Tested Third Party Software
    • Migrate etcd
    • Scale etcd
  • Platform Support
    • Mayastor Installation on MicroK8s
  • Troubleshooting
    • Basic Troubleshooting
    • Known Limitations
    • Known Issues
    • FAQs
Powered by GitBook
On this page
  • Prerequisites
  • Create a volume restore of the existing snapshot

Was this helpful?

Export as PDF
  1. Advanced Operations

Volume Restore from Snapshot

PreviousVolume SnapshotsNextUpgrade

Last updated 10 months ago

Was this helpful?

This website/page will be End-of-life (EOL) after 31 August 2024. We recommend you to visit for the latest Mayastor documentation (v2.6 and above).

Mayastor is now also referred to as OpenEBS Replicated PV Mayastor.

Volume restore from an existing snapshot will create an exact replica of a storage volume captured at a specific point in time. They serve as an essential tool for data protection, recovery, and efficient management in Kubernetes environments. This article provides a step-by-step guide on how to create a volume restore.

Prerequisites

Step 1: Create a storage class

To begin, you'll need to create a StorageClass that defines the properties of the snapshot to be restored. Refer to for more details. Use the following command to create the StorageClass:

thin: "true" and repl: "1" is the only supported combination.

cat <<EOF | kubectl create -f -
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: mayastor-1-restore
parameters:
  ioTimeout: "30"
  protocol: nvmf
  repl: "1"
  thin: "true"
provisioner: io.openebs.csi-mayastor
EOF
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: mayastor-1-restore
parameters:
  ioTimeout: "30"
  protocol: nvmf
  repl: "1"
  thin: "true"
provisioner: io.openebs.csi-mayastor

Note the name of the StorageClass, which, in this example, is mayastor-1-restore.

Step 2: Create a snapshot

Note the snapshot's name, for example, pvc-snap-1.


Create a volume restore of the existing snapshot

After creating a snapshot, you can create a PersistentVolumeClaim (PVC) from it to generate the volume restore. Use the following command:

cat <<EOF | kubectl create -f -
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: restore-pvc //add a name for your new volume
spec:
  storageClassName: mayastor-1-restore //add your storage class name 
  dataSource:
    name: pvc-snap-1 //add your volumeSnapshot name
    kind: VolumeSnapshot
    apiGroup: snapshot.storage.k8s.io
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 10Gi
 EOF     
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: restore-pvc //add a name for your new volume
spec:
  storageClassName: mayastor-1-restore //add your storage class name 
  dataSource:
    name: pvc-snap-1 //add your volumeSnapshot name
    kind: VolumeSnapshot
    apiGroup: snapshot.storage.k8s.io
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 10Gi

By running this command, you create a new PVC named restore-pvc based on the specified snapshot. The restored volume will have the same data and configuration as the original volume had at the time of the snapshot.

You need to create a volume snapshot before proceeding with the restore. Follow the steps outlined in to create a volume snapshot.

OpenEBS Documentation
Storage Class Parameters
this guide