Volume Restore from Snapshot
Overview#
Volume Restore from an existing snapshot will create 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 document provides step-by-step instructions to restore a volume from a previously created snapshot using Local PV LVM.
important
Volume Restore is supported only for thin volumes created from snapshots using OpenEBS v4.4.0 or later.
Requirements#
Before performing the restore operation, ensure the following requirements are met:
- A volume snapshot has already been created.
- A compatible StorageClass is available for the restore operation.
- A snapshot has been created for the source volume. Follow the steps outlined in the Volume Snapshots Documentation to create a volume snapshot.
- Only thin snapshot restores are supported. To verify whether a snapshot is thin or thick, describe the LVM snapshot Custom Resource (CR) and check the
spec.thinProvisionfield. - The restore volume request capacity must match the snapshot logical volume (LV) size. To verify snapshot LV size, describe LVM snapshot CR and check the snapshot LV size in
status.lvSizefield. - The Local PV LVM volume group name must match the snapshot’s volume group (
spec.volGroup).
Example: Local PV LVM Snapshot CR
Creating a Volume Restore from an Existing Snapshot#
After a snapshot is created, you can create a new volume (clone) from it. The restored volume will contain the same data as the original volume at the time the snapshot was taken.
To perform a restore, create a PersistentVolumeClaim (PVC) manifest that references the snapshot as a data source.
Command: Create a PVC from an Existing VolumeSnapshot
Example: PVC YAML for Volume Restore
Applying the above YAML creates a new volume from the snapshot lvmpv-snap.
The restored volume is scheduled on the same node as the original volume and retains the same data and properties that existed when the snapshot was taken.
note
- The restored PVC size must match the snapshot LV size (
status.lvSize). - The restored volume must belong to the same volume group (
spec.volGroup). - Ensure that the restored volume is thin-provisioned.
- If a separate StorageClass is used for the restore operation, verify it meets the above criteria.
Verifying the Restored Volume (PVC)#
Verify the restored PVC.
Command
Sample Output
The restored PVC (lvmpv-snap-restore-pvc) has been successfully created and bound.
Verifying the Restored Local PV LVM Volume#
Verify the Local PV LVM volumes.
Command
Sample Output
The restored Local PV LVM volume (pvc-e9c895c0-ddbc-44ea-8f90-7fe81ba723bb) is created and its status is Ready.
Example: Restored LVM Volume CR
note
- To prevent write failures when the thin pool becomes full, enable the following parameters in the
lvm.conffile:thin_pool_autoextend_thresholdthin_pool_autoextend_percent
- Ensure that the Volume Group (VG) has sufficient free capacity. Auto-extend will not function correctly if the VG lacks space.