---
title: Charmhub | Deploy Velero Operator Charm using Charmhub - The Open Operator
  Collection
description: Deploy the latest version of Velero Operator Charm on any cloud.
url: https://charmhub.io/velero-operator/docs/restore-charm-pv
---

# Velero Operator Charm

[Kubeflow Charmers](https://charmhub.io/publisher/ckfbot "View all packages from Kubeflow Charmers")

* [Kubeflow Charmers](https://charmhub.io/publisher/ckfbot "View all packages from Kubeflow Charmers")

Platform:

24.04

edge 503

```
juju deploy velero-operator --channel edge
```

[Learn to deploy on juju >](https://juju.is/docs/juju/manage-applications)

---

#### Relevant links

* [Homepage](https://github.com/canonical/velero-operator)

---

#### Contacts

* [Submit a bug](https://github.com/canonical/velero-operator/issues)

---

Share your thoughts on this charm with the community on discourse.

[Join the discussion](https://discourse.charmhub.io/)

# Restore charm PV

This guide describes how to back up and restore a Persistent Volume for a charm that stores some data in the PVC managed by Juju.

## [Requirements](https://charmhub.io/velero-operator/docs/restore-charm-pv#p-39719-requirements)

* A client charm that provides a backup configuration via the interface. For example, [MinIO operator](https://github.com/canonical/minio-operator/blob/4b7713bd6fbc0b60a473210cd58135be1d9a472f/src/charm.py#L117).
* Charmed Velero deployed and configured.
* The client charm is related to Charmed Velero.

The Juju feature is only available with `export JUJU_DEV_FEATURE_FLAGS=k8s-attach-storage`.

## [Set up the environment variables](https://charmhub.io/velero-operator/docs/restore-charm-pv#p-39719-set-up-the-environment-variables)

Define these variables before running any commands:

```
CLIENT_MODEL="client-model"
CLIENT_APP="my-app"
CLIENT_ENDPOINT="velero-backup-config"
```

## [Create a backup for the client charm](https://charmhub.io/velero-operator/docs/restore-charm-pv#p-39719-create-a-backup-for-the-client-charm)

```
juju switch velero
juju run velero-operator/0 create-backup target=${CLIENT_APP}:${CLIENT_ENDPOINT} model=$CLIENT_MODEL
juju run velero-operator/0 list-backups
```

Save the backup UID from the `list-backups` action for later use.

## [Prepare the client charm](https://charmhub.io/velero-operator/docs/restore-charm-pv#p-39719-prepare-the-client-charm)

```
juju switch $CLIENT_MODEL
juju scale-application $CLIENT_APP 0

juju storage
juju remove-storage ${CLIENT_APP}-data/<id>
```

## [Restore with Charmed Velero](https://charmhub.io/velero-operator/docs/restore-charm-pv#p-39719-restore-with-charmed-velero)

```
juju switch velero
juju run velero-operator/0 list-backups
juju run velero-operator/0 restore backup-uid=<backup-uid>
```

## [Discover restored PVs](https://charmhub.io/velero-operator/docs/restore-charm-pv#p-39719-discover-restored-pvs)

Confirm that the restored Persistent Volume (PV) still points to the old Persistent Volume Claim (PVC) and note the name of the restored PV:

```
kubectl get pv
kubectl get pv <pv-name> -o jsonpath='{.spec.claimRef.namespace}/{.spec.claimRef.name}{"\n"}'
```

## [Import restored PVs into Juju storage & Reattach](https://charmhub.io/velero-operator/docs/restore-charm-pv#p-39719-import-restored-pvs-into-juju-storage-reattach)

Import the restored PV using `juju`. `<storage_name>` is the charm’s storage (e.g., minio-data). The
`--force` flag is required to change the PV’s Reclaim Policy to retain and set PV’s claimRef to null before attaching later.

```
juju import-filesystem kubernetes <pv_name> ${CLIENT_APP}-data --force
```

Reattach the restored PV by retrieving the new storage name from `juju storage` and adding it to the application unit. `--attach-storage` flag instructs Juju to create a new PVC and bind a PV to it.

```
juju add-unit $CLIENT_APP --attach-storage ${CLIENT_APP}-data/<id>
```

## [Check the application](https://charmhub.io/velero-operator/docs/restore-charm-pv#p-39719-check-the-application)

Check the status of the application and confirm that the PVC was reattached:

```
juju status $CLIENT_APP
kubectl -n $CLIENT_MODEL get pvc
kubectl -n $CLIENT_MODEL describe pvc <claim>
```

---
