How to limit storage usage per user?

I’ve read some articles about limiting resources used by users, but none of them mention how to limit storage usage. I want to enforce a 10 GB quota for every user of my environment. How can I do that?

It’s a baremetal deployment. I’m using the default LocalProcessSpawner.

Since you’re using LocalProcessSpawner with local users any storage quotas must be configured and enforced by your operating system, JupyterHub isn’t able to do this. Try searching for something like “linux user home directory quota”:

Is there also an option working with the DockerSpwaner?

c.DockerSpawner.volumes = { 'jupyterhub-user-{username}': notebook_dir}

The Spawner creates a volume for each new user (which are not system users). But is there a way to limit the size of the volume?

There is a tmpfs-size for docker volumes but I have no idea how to tell the DockerSpawener for this specific volume:
https://www.devopsschool.com/blog/how-to-specify-the-size-limit-while-creating-the-docker-volume/

it’s up to the docker volume provider to support volume size, and the ‘local’ provider doesn’t support this. There are workarounds by creating block devices of a fixed size and specifying those as the device for the local volume. tmpfs does support size, but tmpfs is for ephemeral storage that will be deleted.