Persistent storage via named volumes on external media

Question
We are in the process of porting our application to fit in docker containers and the Balena Eco system. In that process we see a possible need for using the persistence and flush functionality of named volumes - we just have the minor issue that we are talking data in terms of several GB. Is it possible to place a named volume on an external media to support large amounts of data while still keeping the features of the named volumes?

Context
Unlike typical IOT devices we handle a lot of data, e.g. video files or point clouds that range in size from a few megabytes to several or even hundreds of gigabytes. The usual workflow is to store the data locally as our bandwith is limited. We are especially interested in the options to flush or persist named volumes during updates. This could of course be part of our app but we would like to use a built-in feature if possible.

To my knowledge this is not possible.

… but you can mount external media devices in your docker service.

Do you have multiple services in your application that need to be able to read and or write to this external media device ?

Do they need to be able to read / write the same files on the external media device ?

You also speak about flush and persist named volumes during updates - what do you mean exactly by this ? To my knowledge data on named volumes is always persisted (unless you explicitly purge it).

Hello @mhe-lorenz as far as I know you should be able to mount an external media as a named volume. You have to mount the drive and then create the volume with docker create -v --drive <name> --opt /path/to/mountpoint then you should be able to run containers using the named volume

So I basically need to mount the device in a container and create a docker volume and then use that as a named volume in other containers?

@janvda, we will probably only have one service that needs access to the device. I basically just don’t want to implement functionality that is already present. My idea was to use a named volume because that would let the OS and supervisor handle the media while allowing the service to read, write, and eventually purge on updates by a supervisor API call.

@mhe-lorenz no, you need to mount the hard drive on your host os to be able to use it as a docker volume.
If you only need to use the drive in one of your containers, don’t create a docker volume, just mount the drive from your container.

In case you want to mount the external media in your (docker container) balena service you can have a look at following 2 examples: