# JupyterHub share folder

**URL:** <https://discourse.jupyter.org/t/jupyterhub-share-folder/19023>\
**Category:** Zero to JupyterHub on Kubernetes\
**Tags:** help-wanted\
**Created:** [April 18, 2023, 6:01pm UTC](https://discourse.jupyter.org/t/jupyterhub-share-folder/19023 "2023-04-18T18:01:28Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![kumaraselva](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/kumaraselva/32/9512_2.png) [@kumaraselva](https://discourse.jupyter.org/u/kumaraselva)\
**Post date:** [April 18, 2023, 6:01pm UTC](https://discourse.jupyter.org/t/jupyterhub-share-folder/19023/1 "2023-04-18T18:01:28Z")

</div>

Can we have share folder/volumn between pods , which are created by Jupyterhub users

---

<div class="post-metadata">

**Author:** ![gcerar](https://avatars.discourse-cdn.com/v4/letter/g/eada6e/32.png) [@gcerar](https://discourse.jupyter.org/u/gcerar)\
**Post date:** [April 18, 2023, 9:30pm UTC](https://discourse.jupyter.org/t/jupyterhub-share-folder/19023/2 "2023-04-18T21:30:39Z")

</div>

Sure you can. On our setup, we have something like

```yaml
singleuser:

...

  storage:
    capacity: 10Gi
    extraVolumes:
      - name: shm-volume
        emptyDir:
          medium: Memory
      
      - name: jupyterhub-shared
        persistentVolumeClaim:
          claimName: jupyterhub-shared-volume

      - name: jupyterhub-datasets
        persistentVolumeClaim:
          claimName: jupyterhub-datasets-volume

    extraVolumeMounts:
      # will increase /dev/shm from default 64MB
      # beneficial for pyTorch's DataLoader
      - name: shm-volume
        mountPath: /dev/shm
      
      - name: jupyterhub-shared
        mountPath: /home/jovyan/shared

      - name: jupyterhub-datasets
        mountPath: /home/jovyan/datasets
        readOnly: true

```

But you need to create volumes manually with something like

```yaml
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: jupyterhub-datasets-volume
  namespace: jupyter
spec:
  accessModes:
    - ReadWriteMany
  resources:
    requests:
      storage: 1Ti

---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: jupyterhub-shared-volume
  namespace: jupyter
spec:
  accessModes:
    - ReadWriteMany
  resources:
    requests:
      storage: 100Gi

```

The only limitation I’m aware of is that your storage driver needs to support `ReadWriteMany` (RWX), but I might be wrong. We use storage on top of `csi-driver-nfs` without an issue.

**EDIT #1**  
Each user will now have a `shared/` and `datasets/` folder. The content will be seen by all users, but only content in `shared/` can be modified.

---

<div class="post-metadata">

**Author:** ![kumaraselva](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/kumaraselva/32/9512_2.png) [@kumaraselva](https://discourse.jupyter.org/u/kumaraselva)\
**Post date:** [April 18, 2023, 10:49pm UTC](https://discourse.jupyter.org/t/jupyterhub-share-folder/19023/3 "2023-04-18T22:49:48Z")

</div>

> [@gcerar](#):
>
> csi-driver-nfs

Thanks, but ReadWriteMany is not supporting for us.  
We have only ReadWriteOnce.

---

<div class="post-metadata">

**Author:** ![gcerar](https://avatars.discourse-cdn.com/v4/letter/g/eada6e/32.png) [@gcerar](https://discourse.jupyter.org/u/gcerar)\
**Post date:** [April 19, 2023, 10:13am UTC](https://discourse.jupyter.org/t/jupyterhub-share-folder/19023/4 "2023-04-19T10:13:52Z")

</div>

@kumaraselva, can you specify what storage system you use? It depends on the driver and whether it supports RWX. Check the table in Kubernetes docs on [PVCs](https://kubernetes.io/docs/concepts/storage/persistent-volumes/#access-modes).

An alternative would be to have a parallel system with NFS or similar, add that as a new type of StorageClass in Kubernetes, and specify it as a storage type for shared volume.

Edit: PVC → StorageClass for the correctness

---

<div class="post-metadata">

**Author:** ![kumaraselva](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/kumaraselva/32/9512_2.png) [@kumaraselva](https://discourse.jupyter.org/u/kumaraselva)\
**Post date:** [April 19, 2023, 6:26pm UTC](https://discourse.jupyter.org/t/jupyterhub-share-folder/19023/5 "2023-04-19T18:26:46Z")

</div>

@gcerar we are using TKGI , our support team says TKGI not support ReadWriteMany.

I am exploring NFS, getting not able to connect the NFS server issue

---

<div class="post-metadata">

**Author:** ![gcerar](https://avatars.discourse-cdn.com/v4/letter/g/eada6e/32.png) [@gcerar](https://discourse.jupyter.org/u/gcerar)\
**Post date:** [April 19, 2023, 7:33pm UTC](https://discourse.jupyter.org/t/jupyterhub-share-folder/19023/6 "2023-04-19T19:33:53Z")

</div>

OK. There is documentation from vSphere [[link](https://docs.vmware.com/en/VMware-vSphere/7.0/vmware-vsphere-with-tanzu/GUID-82AC812A-40E3-4563-9329-747634E1AB6E.html)] that states there is support for ReadWriteMany, which can be enabled but implies some security issues. From the docs, I understand their concerns.

Regarding the NFS server. From your statement, it is not clear what would be a problem. If I go with Occam’s razor, I would guess that the NFS server is not in the same network as the K8s cluster (e.g., 192.168.0.0/24). So they must be in the same subnet **or** explicitly permitted access from other subnets. See this blog [post](https://earlruby.org/2022/01/setting-up-nfs-fsid-for-multiple-networks/) for reference.

---

<div class="post-metadata">

**Author:** ![jrdnbradford](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/jrdnbradford/32/18030_2.png) [@jrdnbradford](https://discourse.jupyter.org/u/jrdnbradford)\
**Post date:** [April 25, 2023, 4:12pm UTC](https://discourse.jupyter.org/t/jupyterhub-share-folder/19023/7 "2023-04-25T16:12:17Z")

</div>

What have you found to be the easiest way to get data into the readonly shared disk?

---

<div class="post-metadata">

**Author:** ![kumaraselva](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/kumaraselva/32/9512_2.png) [@kumaraselva](https://discourse.jupyter.org/u/kumaraselva)\
**Post date:** [April 25, 2023, 5:28pm UTC](https://discourse.jupyter.org/t/jupyterhub-share-folder/19023/8 "2023-04-25T17:28:51Z")

</div>

Still looking, NFS is best option.

---

<div class="post-metadata">

**Author:** ![kumaraselva](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/kumaraselva/32/9512_2.png) [@kumaraselva](https://discourse.jupyter.org/u/kumaraselva)\
**Post date:** [April 25, 2023, 5:31pm UTC](https://discourse.jupyter.org/t/jupyterhub-share-folder/19023/9 "2023-04-25T17:31:00Z")

</div>

Once mount the NFS pvc, trying to mount the pvc via yaml file. When I am lunching jupyterhub, getting error like “Not able to connect the nfs server”

---

<div class="post-metadata">

**Author:** ![gcerar](https://avatars.discourse-cdn.com/v4/letter/g/eada6e/32.png) [@gcerar](https://discourse.jupyter.org/u/gcerar)\
**Post date:** [April 26, 2023, 7:30am UTC](https://discourse.jupyter.org/t/jupyterhub-share-folder/19023/10 "2023-04-26T07:30:29Z")

</div>

- Check firewall settings
- NFS folder for PVC must be completely empty (not even dotfiles). Otherwise, k8s will complain.
- NFS folder must have RW permissions for `nobody:nogroup`.

---

<div class="post-metadata">

**Author:** ![kumaraselva](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/kumaraselva/32/9512_2.png) [@kumaraselva](https://discourse.jupyter.org/u/kumaraselva)\
**Post date:** [April 29, 2023, 2:28am UTC](https://discourse.jupyter.org/t/jupyterhub-share-folder/19023/11 "2023-04-29T02:28:48Z")

</div>

Thanks will check and update here
