You are looking at the documentation of a prior release. To read the documentation of the latest release, please
visit here.
Stand-alone Volume Backup Overview
If you are using a volume that can be mounted in multiple workloads, aka ReadWriteMany/RWX, you might want to backup the volume independent of the workloads. Stash supports backup of stand-alone volumes. This guide will give you an overview of how stand-alone volume backup and restore process works in Stash.
How Backup Works
The following diagram shows how Stash takes backup of a stand-alone volume. Open the image in a new tab to see the enlarged version.
The backup process consists of the following steps:
At first, a user creates a secret with access credentials of the backend where the backed up data will be stored.
Then, she creates a
Repositorycrd that specifies the backend information along with the secret that holds the credentials to access the backend.Then, she creates a
BackupConfigurationcrd targeting the volume. TheBackupConfigurationobject also specifies theTaskto use to backup the volume.Stash operator watches for
BackupConfigurationcrd.Once Stash operator finds a
BackupConfigurationcrd, it creates a CronJob with the schedule specified inBackupConfigurationobject to trigger backup periodically.On next scheduled slot, the CronJob triggers a backup by creating a
BackupSessioncrd.Stash operator also watches for
BackupSessioncrd.When it finds a
BackupSessionobject, it resolves the respectiveTaskandFunctionand prepares a backup Job definition.Then, it mounts the targeted volume into the Job and creates it.
The Job takes backup of the targeted volume.
Finally, when backup is completed, the Job sends Prometheus metrics to the Pushgateway running inside Stash operator pod. It also updates the
BackupSessionandRepositorystatus to reflect the backup procedure.
How Restore Works
The following diagram shows how Stash restores backed up data into a stand-alone volume. Open the image in a new tab to see the enlarged version.
The restore process consists of the following steps:
At first, a user creates a
RestoreSessioncrd which specifies the targeted volume where the backed up data will be restored and theRepositorycrd which holds the backend information where the backed up data has been stored. It also specifies theTaskto use to restore the target.Stash operator watches for
RestoreSessionobject.Once it finds a
RestoreSessionobject, it resolves the respectiveTaskandFunctionand prepares a restore Job definition.Then, it mounts the targeted volume into the Job and creates it.
The Job restores the backed up data into the volume.
Finally, when the restore process is completed, the Job sends Prometheus metrics to the Pushgateway and update the
RestoreSessionstatus to reflect restore completion.
Why use Function-Task model to backup or restore a volume
You might be wondering why we have used Function and Task to backup or restore a volume. Well, let us explain.
Function-Task model gives you the flexibility to customize the backup/restore process. For example, it enables you to execute some logic to prepare your apps before backup or execute logic to delete corrupted data before restore. For more details about what are the others benefits of Function-Task model, please visit here.
Next Steps
- Learn how to backup and restore a stand-alone PVC from here.






