# Persistent volume restored from backup - can't create pvc

**URL:** <https://forums.suse.com/t/persistent-volume-restored-from-backup-cant-create-pvc/13817>\
**Category:** SUSE Storage\
**Created:** [March 31, 2019, 7:02pm UTC](https://forums.suse.com/t/persistent-volume-restored-from-backup-cant-create-pvc/13817 "2019-03-31T19:02:24Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vito\_Botta](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/vito_botta/32/5004_2.png) [@Vito\_Botta](https://forums.suse.com/u/Vito_Botta)\
**Post date:** [March 31, 2019, 7:02pm UTC](https://forums.suse.com/t/persistent-volume-restored-from-backup-cant-create-pvc/13817/1 "2019-03-31T19:02:24Z")

</div>

Hi all,

I am new to Rancher and Longhorn and so far I am absolutely LOVING this stuff! I am having a weird issue when restoring volumes from backup. Actually the restore itself is easy and it works, but I see errors when trying to reuse them in Rancher.

So if I restore a volume from a backup, I then go (in Rancher) to luster/Storage/Persistent Volumes and create a volume selecting Longhorn as the plugin and the storage class, and correctly configuring the capacity/size to the same value as the actual size of the volume restored. When I create this volume I don’t see any errors etc, but when I create a persistent volume claim (project/Workloads/Volumes) and select the persistent volume I just created, the pvc is stuck in ‘pending’ state and I get the following error in the events:

```auto
Cannot bind to requested volume "wp-app": storageClassName does not match

```

So it doesn’t work and I can’t use that pvc when deploying Wordpress in this example.

However, I watched a Rancher meetup video from September (on Youtube) about Longhorn, and following that I tried creating the persistent volume the kubectl/yaml way with this yaml:

```auto
apiVersion: v1
kind: PersistentVolume
metadata:
  name: wp-app
spec:
  capacity:
    storage: 1Gi
  volumeMode: Filesystem
  accessModes:
    - ReadWriteOnce
  persistentVolumeReclaimPolicy: Delete
  csi:
    driver: io.rancher.longhorn
    fsType: ext4
    volumeAttributes:
      numberOfReplicas: '3'
      staleReplicaTimeout: '20'
    volumeHandle: wp-app

```

This way all works and when I create the pvc the state changes to ‘bound’, after which I can launch the app and select the pvc etc.

So the question is, is it a bug in Rancher when linking persistent volumes to Longhorn volumes, or in Longhorn? Am I doing it wrongly? Is it possible to do this through the UI instead of the yaml way?

Thanks a lot in advance!

---

<div class="post-metadata">

**Author:** ![yasker](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/yasker/32/137_2.png) [@yasker](https://forums.suse.com/u/yasker)\
**Post date:** [April 1, 2019, 6:49pm UTC](https://forums.suse.com/t/persistent-volume-restored-from-backup-cant-create-pvc/13817/2 "2019-04-01T18:49:47Z")

</div>

Hi @Vito_Botta

Yeah, it’s a Rancher bug, and we haven’t got time to fix it in 2.2 release.

> <https://github.com/rancher/rancher/issues/17972>
>
> CSI is the default driver for Kubernetes 1.10+.
> 
> The yaml spec for CSI looks l…ike this:
> 
> \`\`\`
> apiVersion: v1
> kind: PersistentVolume
> metadata:
> name: longhorn-vol-pv
> spec:
> capacity:
> storage: 2Gi
> volumeMode: Filesystem
> accessModes:
> - ReadWriteOnce
> persistentVolumeReclaimPolicy: Delete
> csi:
> driver: io.rancher.longhorn
> fsType: ext4
> volumeAttributes:
> fromBackup: ""
> numberOfReplicas: '3'
> staleReplicaTimeout: '30'
> volumeHandle: \<existing-longhorn-volume-name\>
> \`\`\`
> 
> If a PV is manually created, it must have \`volumeHandle\` pointed to an \*\*existing\*\* Longhorn volume. It's the limitation of CSI at the moment. So the user must provide input to \`volumeHandle\` field.

Also, in Longhorn v0.5.0 (next release), we will add support to create PV/PVC from Longhorn directly so it would be easier for user to use restored volumes in Longhorn.

---

<div class="post-metadata">

**Author:** ![Vito\_Botta](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/vito_botta/32/5004_2.png) [@Vito\_Botta](https://forums.suse.com/u/Vito_Botta)\
**Post date:** [April 1, 2019, 7:23pm UTC](https://forums.suse.com/t/persistent-volume-restored-from-backup-cant-create-pvc/13817/3 "2019-04-01T19:23:16Z")

</div>

Thanks for the confirmation, and for all the work behind these amazing projects! Really loving this stuff.  
I was wondering whether I could use Longhorn in production already? At the moment I am experimenting but I would love to use it as the storage backend for a cluster I will use for a new project I have just started. Would this be OK or not yet? Thanks!

---

<div class="post-metadata">

**Author:** ![yasker](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/yasker/32/137_2.png) [@yasker](https://forums.suse.com/u/yasker)\
**Post date:** [April 1, 2019, 8:12pm UTC](https://forums.suse.com/t/persistent-volume-restored-from-backup-cant-create-pvc/13817/4 "2019-04-01T20:12:32Z")

</div>

Thanks @Vito_Botta , but Longhorn is not production ready yet. Storage system is very critical to user’s data, so we have been very conservative about people using it in the production.

We’re planning to release v0.5.0 as Beta in a couple of month, and release v1.0 GA this year.

In any case, keep a good backup of your volume is critical to the safety of your volume. We will add more features to help and emphasis that in the coming releases.

---

<div class="post-metadata">

**Author:** ![Vito\_Botta](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/vito_botta/32/5004_2.png) [@Vito\_Botta](https://forums.suse.com/u/Vito_Botta)\
**Post date:** [April 1, 2019, 8:23pm UTC](https://forums.suse.com/t/persistent-volume-restored-from-backup-cant-create-pvc/13817/5 "2019-04-01T20:23:50Z")

</div>

I see 🙂 I will continue to play with it for now and looking forward to the GA!
