How to add persistent storage for Balena OS on Raspberry PI?

Interesting questions.

Regarding the mounting.
I think you have to mount it by means of startup script in one of your containers.
Here 2 examples:

  1. https://github.com/janvda/balena-samba-rsync <= mounts an USB external drive.
  2. https://github.com/janvda/balena-node-red-mqtt-nginx-TIG-stack <= in this repository an USB memory stick is mounted in the influx db container.

Note that you can’t mount the same drive partition in multiple containers (https://github.com/janvda/balena-node-red-mqtt-nginx-TIG-stack/issues/3).

… but what I didn’t try out (like you suggested) is to mount it in a data container and share it to other containers via Volumes. I think that is certainly worth a try. So for that I would create a subfolder in that volume and mount the drive to that subfolder.

If that doesn’t work, you can also mount it in one container and share it via nfs to the other containers.

kr
Jan.

2 Likes