Better way to mount virtiofs in Home Assistant OS?

My setup: Raspberry Pi 5 with Raspberry Pi OS and “haos_generic-aarch64-18.1.qcow2.xz” in a KVM created with virt-install as follows.

sudo virt-install \
                --name haos \
                --description "Home Assistant OS" \
                --os-variant="alpinelinux3.21" \
                --ram=2048 \
                --vcpus=2 \
                --disk "/mnt/ssd1/KVM/haos/haos_generic-aarch64-18.1.qcow2,bus=scsi \
                --controller type=scsi,model=virtio-scsi \
                --memorybacking source.type=memfd,access.mode=shared \
                --filesystem type=mount,accessmode=passthrough,driver.type=virtiofs,driver.queue=1024,source=/mnt/ssd1/Music,target=music \
                --hostdev "0x0bda:0xa729" \
                --import \
                --graphics none \
                --boot uefi,firmware.feature0.name=secure-boot,firmware.feature0.enabled=no \
                --noautoconsole

Music Assistant installed as App in Home Assistant.

Both Home Assistant and Music Assistant work fine.

My music is in /mnt/ssd1/Music on an SSD mounted on /mnt/ssd1 on the Raspberry Pi 5 itself.

I would like to make the music available in both Home Assistant and Music Assistant via virtiofs.

Tried and does not work:

  • Mounting the virtiofs filesystem inside the homeassistant docker container (mkdir -p /media/Music; mount -t virtiofs music /media/Music) works, but only mounts it in the HomeAssistant container. The mount is not available in the Music Assistant App.
  • Music Assistant only has NFS, Samba, and local filesystem options for music sources, but can’t mount virtiofs.

My workaround: mount the virtiofs filesystem on Home Assistant OS itself:

  • In Raspberry Pi OS: sudo virsh console haos
  • log in as root user without password
  • Create and edit file /mnt/overlay/etc/udev/rules.d/mount-virtiofs.rules with one line: ACTION=="add", RUN+="/bin/sh -c 'if [ -e /mnt/data/supervisor/media ]; then /usr/bin/systemd-run /usr/bin/mount --onlyonce -m -t virtiofs music /mnt/data/supervisor/media/Music; fi'"
  • press CTRL-D and CTRL-] to exit the console and return to Raspberry Pi OS.
  • sudo virsh reboot haos
  • Now the virtiofs share is mounted on /mnt/data/supervisor/media/Music and therefore available at /media/Music in both Home Assistant and Music Assistant.

My question: is there a better/official way to mount a virtiofs filesystem in Home Assistant OS? I have looked everywhere, found other people asking about it but no solution. Using an udev rule as a workaround is not optimal.