Z2JH: How to persist storage at root level

I want to persist storage for single user notebook at root level. What’s the best way to implement that?

I tried using, but it resulted in an error

singleuser:
      storage:
        homeMountPath: /

I don’t think you can, since if you mount something on / that hides everything in the container, so not surprisingly things won’t work. If you can tell us more about your overall aim and your use-cases we might be able to suggest some alternatives.

Thanks @manics for jumping in to answer, appreciate it.

We want our users to persist the installed OS/python packages/plugins across restarts as we have culling enabled after certain hours of inactivity to save on resources.

These packages/plugins can be located at different locations as per user’s config. I know as a best practise this should all go in the image from CI at the end of day. But, is there anything else that could be done? Additionally, if this is a native k8s behaviour that I am seeing here, all files goes missing at the mount path?

tmp - What happens when you 'mount over' an existing folder with contents? - Unix & Linux Stack Exchange explains what happens when you mount a volume over an existing directory on Unix/Linux, it’s not specific to K8s.

I can’t think of a way to preserve OS level changes across restarts of the K8s pod, the nature of K8s is that pods are deleted and recreated. If it’s just python packages and plugins you could make everything in your image read-only and instruct your users to create a virtualenv or conda environment in their home directory.