We should have installed the ZFS-LocalPV 1.0.0 or later version for the Backup and Restore, see [readme](../README.md) for the steps to install the ZFS-LocalPV driver.
## Setup
### 1. Install Velero CLI
follow the steps mentioned [here](https://velero.io/docs/v1.4/basic-install/) to install velero CLI
The above minio uses tmp directory inside the pod to store the data, so when restart happens, the backed up data will be gone. We can change the above yaml to use persistence storage to store the data so that we can persist the data after restart.
Create the volume snapshot location which has the information about where the snapshot should be stored
```yaml
apiVersion: velero.io/v1
kind: VolumeSnapshotLocation
metadata:
name: zfspv
namespace: velero
spec:
provider: openebs.io/zfspv-blockstore
config:
bucket: velero
prefix: zfs
namespace: openebs # this is namespace where ZFS-LocalPV creates all the CRs, passed as OPENEBS_NAMESPACE env in the ZFS-LocalPV deployment
provider: aws
region: minio
s3ForcePathStyle: "true"
s3Url: http://minio.velero.svc:9000
```
if you have deployed the ZFS-LocalPV to use different namespace then please use that namespace in the above yaml. To find what namespace ZFS-LocalPV driver is using, we can check what is the value of OPENEBS_NAMESPACE env passed to the ZFS-LocalPV Pods.
Check the volumesnapshot location
```
kubectl get volumesnapshotlocations.velero.io -n velero
Create the backup using the below velero command, add all the namespaces you want to backed up in comma separated format in --include-namespaces parameter.
We can restore the backup using below command, we can provide the namespace mapping if we want to restore in different namespace. If namespace mapping is not provided, then it will restore in the source namespace in which the backup was present.
NAME BACKUP STATUS WARNINGS ERRORS CREATED SELECTOR
my-backup-20200914211331 my-backup InProgress 0 0 2020-09-14 21:13:31 +0530 IST <none>
```
Once the Status is Completed we can check the pods in the destination namespace and verify that everything is up and running. We can also verify the data has been restored.
### 6. Uninstall Velero
We can delete the velero installation by using this command