Mount SD for all containers

Hi,
we are writing a lot of data to SD card, and we need multiple containers to use that data.
i saw in https://www.balena.io/docs/learn/develop/runtime/ that its not possible to share a mounted device.
what is the right solution than? enabling auto mounting in every container that use the sd? (using this project: https://github.com/balena-io-playground/balena-storage )
or the right way is just adding to the start scripts of those container the mount commands?
i’m not sure i totally understood this: https://github.com/balena-io-playground/balena-storage , this is what i should use in every container that i need to use the SD? how would i know the mounting name?

Thanks,

Daniel.

1 Like

Hey, it’s not possible to mount a storage device into several containers. I would recommend mounting it into a single container and using that as the data store. For example you could run a db process in that container, which writes to and reads from the external storage.

We do have plans to enrich the process of using external storage with balena devices, but I don’t have a time frame on this right now.

Not sure i follow the db suggestion.
what i did for now, is mounting explicitly the SD from each container i want to use, so he can read\write data from there.
if i have just 1 service doing that, how would it be possible to access the data?

Hi Daniel,
The db suggestion implied just one container accessing the data base and storing it in external storage, while the rest access the database through a socket for example.
In you current solution, how do you provide mutual exclusive access to this shared resource?

Currently the access is being very synchronized, no way two containers will access the same file.
1 is saving data from cameras, when that finish the data being processed, never the same time.
so my solution is correct? just mounting each container?

Hi Daniel, currently BalenaOS does not support sharing a mounted device. When you mount the external storage in one container, only that container will be able to access it. This feature request is in the roadmap but we currently don’t have a projected date for its implementation.
So for your use case, you will need to implement some type of data proxy.

1 Like

Still no estimated date on this?

Hello, at the moment this feature is being discussed and the interest has been noted, but we haven’t got a timeframe established yet. Thanks

1 Like