RPi 4 - Automount NAS on boot

  • Hi all

    I have LibreELEC installed on a Raspberry Pi 4 - and it is great. I am using it with TVHeadend and want to store my recordings on a NAS. I can mount the NAS through SSH without any problem, but need the system to do this automatically at boot.

    I found this in the Wiki, which looks like the right way of doing it (https://wiki.libreelec.tv/configuration/…20using%20nano.) but the instructions say "but note they will block the boot process until they complete, and the network stack will not be up when the script runs" which worried me.

    Clearly if I try to mount the drive before the network stack is up, then it will fail. If I put in a wait for ping loop, then that will never occur until after the autostart.sh is complete (so the system will never boot - I assume).

    So... how do I automatically mount the NAS on boot with these constraints?

    Thanks :thumbup:

  • Go to Best Answer
  • Go look at the systemd .mount file samples in /storage/.config/system.d .. these are sequenced correctly during startup to mount things after the network comes up and before Kodi (and TVH add-ons) are started.

  • 1. Create a mountpoint like /storage/Recordings, go to /storage/.config/system.d and create a new file like recordings.mount

    save it.

    2. run systemctl daemon-reload

    3. run systemctl enable recordings.mount

    4. reboot

    you should be able to access your content