Volume Snapshots
Volume snapshots are copies of a persistent volume at a specific point in time. They can be used to restore a volume to a previous state or create a new volume. Replicated PV Mayastor provides support for industry standard copy-on-write (COW) snapshots, which is a popular methodology for taking snapshots by keeping track of only those blocks that have changed. Replicated PV Mayastor incremental snapshot capability enhances data migration and portability in Kubernetes clusters across different cloud providers or data centers. Using standard kubectl commands, you can seamlessly perform operations on snapshots and clones in a fully Kubernetes-native manner.
Use cases for volume snapshots include:
- Efficient replication for backups
- Utilization of clones for troubleshooting
- Development against a read-only copy of data
Volume snapshots allow the creation of read-only incremental copies of volumes, enabling you to maintain a history of your data. These volume snapshots possess the following characteristics:
- Consistency: The data stored within a snapshot remains consistent across all replicas of the volume, whether local or remote.
- Immutability: Once a snapshot is successfully created, the data contained within it cannot be modified.
Currently, Replicated PV Mayastor supports the following operations related to volume snapshots:
- Creating a snapshot for a PVC
- Listing available snapshots for a PVC
- Deleting a snapshot for a PVC
#
Prerequisites- Install and configure Replicated PV Mayastor by following the steps given here and create disk pools.
- Create a Replicated PV Mayastor StorageClass with single replica.
note
Currently, Replicated PV Mayastor only supports snapshots for volumes with a single replica. Snapshot support for volumes with more than one replica will be available in the future versions.
Command
YAML (single replica)
- Create a PVC using these steps and check if the status of the PVC is Bound.
Command
Example Output
note
Copy the PVC name, for example, ms-volume-claim
.
- (Optional) Create an application by following these steps.
#
Create a SnapshotYou can create a snapshot (with or without an application) using the PVC.
Follow the steps below to create a volume snapshot:
#
Step 1: Create a Kubernetes VolumeSnapshotClass objectCommand
YAML
Parameters | Type | Description |
---|---|---|
Name | String | Custom name of the snapshot class |
Driver | String | CSI provisioner of the storage provider being requested to create a snapshot (io.openebs.csi-mayastor) |
Apply VolumeSnapshotClass Details
Command
Example Output
#
Step 2: Create the SnapshotCommand
YAML
Parameters | Type | Description |
---|---|---|
Name | String | Name of the snapshot |
VolumeSnapshotClassName | String | Name of the created snapshot class |
PersistentVolumeClaimName | String | Name of the PVC. Example- ms-volume-claim |
Apply the Snapshot
Command
Example Output
note
When a snapshot is created on a thick-provisioned volume, the storage system automatically converts it into a thin-provisioned volume.
#
List SnapshotsTo retrieve the details of the created snapshots, use the following command:
Command
Example Output
Command
Example Output
#
Delete a SnapshotTo delete a snapshot, use the following command:
Command
Example Output
#
Filesystem Consistent SnapshotThe filesystem consistent snapshot ensures that the snapshot filesystem remains consistent while taking a volume snapshot. Before taking the volume snapshot, the csi-node plugin runs the FIFREEZE and FITHAW ioctls on the underlying filesystem to flush and quiesce any active IOs. After the snapshot creation process, the IOs are resumed.
By default, mayastor volume snapshots are fs consistent. This means that if any part of creating a snapshot or an ioctl fails, the whole process will fail and be tried again by the mayastor CSI-controller without any user intervention.
You can disable the fs consistency feature using the VolumeSnapshotClass parameter quiesceFS
. See the below example to disable the feature: