Storage Directories Shared by Multiple Containers/Services

I’m setting up an Ubuntu Server with ZFS storage, Samba and Docker for file- and media services like NextCloud, Plex, Calibre, Sonarr etc. (using mostly LSIO containers), but I’m not quite sure of the best way to organize my folder/datasets and whether or not the are concerns with regards to storage directories being accessed by multiple containers/services.

For instance i would like to be able to upload a video remotely through NextCloud and have it be available in Plex and also on my LAN vis Samba shares (in which case I guess all three services would need to use a “/video” directory).

Can I run into conflict/permissions issues if multiple services utilizes the same folder/dataset and are there any best practices on how to configure this?

As a layperson I can’t comment on whether this is a good practice or not, but this is what I do since most of the containers I use are media related, so they all need access to the same directory of media.

I set my system up using DockSTARTer, which is a convenience wrapper for setting up a Docker compose config, and it shares a common storage mount amongst all the containers. It sets a variable in .env that all the container configs use.

Thanks for your input! I have already checked out DockSTARTer actually. It looks nice, but I would really like to set up my things manually to have better control :slight_smile:

Sure. Note DockSTARTer just configures the compose configs for you so you could use it to get ramped up fast then stop using it and manage the compose config it generates yourself.

1 Like

I run the same setup (except I run microk8s instead of docker), it all depends on what services you have. I only run airsonic, jellyfin, deluge and smb sharing the same media folders. Only deluge and a few smb users has write access to the folders, all services have their own config folders also shared by smb so I can change settings whenever I want to. Never had a problem.

If you have more than one service mutating data on the shares you need to make sure they don’t interfer with one another. Most media servers should work fine with read access though.

This is the current hierarchy I am envisioning for the ZFS storage. Would I just mount the whole thing under /mnt in Ubuntu and then bind the datasets as required to the applicable Docker containers or is there something more to it?

Up to you. You can split of different content into different volumes on zfs and mount them separately. I have a media volume for my media content that is available at /mnt/media. You can thin provision volumes (that don’t reserve actual space in the pool until it’s used) use quotas or resize volumes if you want to. So it sort of depends on how you want to slice your pool. You could have one huge volume using the entire pool and use a hierarchy of the type you just suggested too.

And yes, you just mount it into you container. Nothing more than that.

When you say “volumes” do you actually mean “datasets”?

Is thin provision something you do at the ZFS dataset level? If it is not set what happens then? What amount of space will be reserved and by whom?

Sorry if these are stupid questions, but I feel like I am learning everything at once here :slight_smile:

Yes, I did mean datasets.

Yes, it’s on the dataset level. Thin (I believe ZFS calls it sparse) provisioning is only for the volume type dataset and quotas/reservations are for filesystem type dataset. They have different default behavior if I recall.

My not so clear point was you probably should figure out your use case before you select layout. I believe your setup is good for future proofing and administration since you have several levels to do recursive admin commands on and can import datasets from other pools without name collisions. On the other hand maybe alot of the filesystems you created could just be a simple folder within a filesystem.

Since all root filesystems (created with the pool) are mounted under the /poolname you don’t have to mount it yet again under /mnt unless you absolutely want to. Personally I don’t use that subdataset hierarchy since I’m a simple user :slight_smile:, I only have the root filesystem and two sub-datasets that are mounted under /mnt in their turn.

1 Like