Defining shared NFS mount across devices?

Use cases is as follows: Devices require persistent volumes/data in high turn over environment. I have network storage for that exact purpose but cannot find anywhere on ResinOS to define a common NFS mount point on all my devices so they can retrieve and store bulk data from the shared directory on my SAN/NAS.

I think you would connect NFS mounts in your start script (so the application connects to the shared storage whenever the application starts up). So that would be just running the regular NFS mount commands in your start script (or using systemd to automate that at start).

If I’m not mistaken, @andrei was doing something like that recently, he might be able to add some more details? :crystal_ball:

I did exactly what you proposed @imrehg : Added the mount in my startup script.

Hi !

Well can’t find more info regarding nfs docker volume. It seems to be a plugin in first that have been include in docker. It could explain why not working in the balena engine.

I also try to install nfs-utils and mount it using Dockerfile (my ugly way in the CMD) :

FROM arm32v7/alpine:latest

RUN apk update && \
    apk upgrade && \
    apk add --no-cache alsa-utils alsa-utils-doc alsa-lib alsaconf && \
    apk add --no-cache nfs-utils && \
    apk add --no-cache busybox gstreamer gst-plugins-base gst-plugins-good gst-plugins-bad gst-plugins-ugly py3-gst py3-libxml2 py3-pykka py3-requests py3-setuptools py3-six py3-tornado python3 python3-dev

RUN python3 -m pip install --upgrade pip && \
    python3 -m pip install --upgrade mopidy && \
    python3 -m pip install --upgrade Mopidy-Iris && \
    python3 -m pip install --upgrade Mopidy-Local && \
    python3 -m pip install --upgrade Mopidy-Youtube && \
    python3 -m pip install --upgrade Mopidy-SoundCloud
RUN mkdir /root/music

COPY mopidy.conf /root/.config/mopidy/mopidy.conf

CMD mount -t nfs /root/music && mopidy

I will look for a better way later. I have to work on the mopidy conf

I think you’re doing exactly as my colleagues mentioned above, we also have some useful information about mounting external storage media in our docs so please have a look.

So, it appears that balenaOS 2.31.5+rev1 is not providing NFS support (yet):

root@xxxxxxx:~# cat /proc/filesystems
nodev	sysfs
nodev	rootfs
nodev	ramfs
nodev	bdev
nodev	proc
nodev	cpuset
nodev	cgroup
nodev	cgroup2
nodev	tmpfs
nodev	devtmpfs
nodev	binfmt_misc
nodev	debugfs
nodev	tracefs
nodev	sockfs
nodev	dax
nodev	pipefs
nodev	hugetlbfs
nodev	rpc_pipefs
nodev	devpts
nodev	nfs
nodev	nfs4
nodev	autofs
nodev	aufs
nodev	mqueue

Notice the nodev in front of:

nodev	nfs
nodev	nfs4

Also, we can check the kernel modules for NFS via:

root@xxxxxxx:~# lsmod | grep -i nfs

This differs from a system with NFS installed:

$ lsmod | grep nfs
nfsd                  339968  13
auth_rpcgss            61440  1 nfsd
nfs_acl                16384  1 nfsd
lockd                  94208  1 nfsd
grace                  16384  2 nfsd,lockd
sunrpc                331776  18 nfsd,auth_rpcgss,lockd,nfs_acl

So, you this will require compiling these kernel modules yourself and adding them. It’s possible, but requires some tricks due to the ReadOnly root FS that Balana uses.

Luckily, balenaOS will run containers in --privileged mode. So, loading kernel module binaries packaged with a Docker container is possible! I tested this with some other kernel modules with some success. I was able to get snd-usb-audio and snd-usb-caiaq sound card drivers working on an Intel Edison running balenaOS!