I don’t know why it is not working for you (I haven’t used that approach).
In following repository I have manually mounted a USB stick in the influxdb service:
So the important changes are:
Add a line like the following in your dockerfile.template:
# So the instruction below refers to a connected USB drive with label "influxdb" which should be in "ext4" format.
RUN echo "LABEL=influxdb /mnt/influxdb ext4 rw,relatime,discard,data=ordered 0 2" >> /etc/fstab
In your start script or entrypoint script you must put something like (in my case it has been put in file my_entrypoint.sh)
# JVA 2018-11-15 I have added following instructions to mount usbdrive and create subfolder influxdb
mkdir -p /mnt/influxdb
mount /mnt/influxdb
@nazrhom Thanks for the reply - I notice that it suggests not to use an init system when using multi-containers so I’ll try doing it without an init system.
If balena images by default are not starting any init system, then I would make this clear in the balena documentation that you have to activate the init system (with link to how this can be done).
If you have lots of issues with systemd will this also not mean that the other people might encounter those issues when activating systemd for mounting USB ? In that case, isn’t it better to remove this option from the documentation to prevent people going down that hole ?
Thanks for the response. I’ve set this up but I can’t seem to find the /mnt/storage in the terminal - how would I check that it has all mounted correctly?
Hey @janvda thanks for the suggestions, our images did use systemd for some time and there are still some parts of the documentation that could be improved to reflect this is the default now. For example, https://www.balena.io/docs/learn/develop/runtime/#mounting-external-storage-media should make it more clear that, unless you manually activated the init system, you should really be looking at the “Without the init system”. I created an issue on the docs about this.