# Restore/bind a deleted dynamically provisioned PV/PVC

**URL:** <https://forums.suse.com/t/restore-bind-a-deleted-dynamically-provisioned-pv-pvc/43281>\
**Category:** SUSE Storage\
**Created:** [May 28, 2024, 12:21pm UTC](https://forums.suse.com/t/restore-bind-a-deleted-dynamically-provisioned-pv-pvc/43281 "2024-05-28T12:21:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![crazyelectron](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/crazyelectron/32/9045_2.png) [@crazyelectron](https://forums.suse.com/u/crazyelectron)\
**Post date:** [May 28, 2024, 12:21pm UTC](https://forums.suse.com/t/restore-bind-a-deleted-dynamically-provisioned-pv-pvc/43281/1 "2024-05-28T12:21:06Z")

</div>

Is there an easy _automated_ workflow possible to restore deleted volumes and reuse them when doing a workload or cluster rebuild.

I use Ansible to provision my workloads and accompanying storage with dynamically provisioned storage on Longhorn (1.6.1). If - for testing purposes - I take the following steps:

1. Create a dynamically provisioned PVC, named config-pvc, which gets a volume named `pvc-41d41cb5-3570-42ef-8beb-6b702cbf17e4`.
2. Create a Deployment and bind the PVC `config-pvc` to the Pod.
3. Create a snapshot and backup of the volume.
4. Delete the Deployment (to simulate cluster rebuild).
5. Delete the dynamically provisioned volume `pvc-41d41cb5-3570-42ef-8beb-6b702cbf17e4` (in the Longhorn UI).
6. Restore the backup and use the same volume name.
7. Create the Deployment again with the PVC `config-pvc`.
8. A new Volume is created with a new name.

I understand I can manually override this behavior when recreating the workload, but I don’t see how I can include that in an automated deployment using Ansible (or a GitOps solution like Fleet for that matter).

---

<div class="post-metadata">

**Author:** ![shuo-wu](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/shuo-wu/32/6426_2.png) [@shuo-wu](https://forums.suse.com/u/shuo-wu)\
**Post date:** [May 28, 2024, 5:28pm UTC](https://forums.suse.com/t/restore-bind-a-deleted-dynamically-provisioned-pv-pvc/43281/2 "2024-05-28T17:28:59Z")

</div>

I guess you can USE the **CSI VolumeSnapshot** feature instead. See [Longhorn | Documentation](https://longhorn.io/docs/1.6.2/snapshots-and-backups/csi-snapshot-support/csi-volume-snapshot-associated-with-longhorn-backup/) for details.
