Mounting NFS share on boot

  • Hello everyone,


    I have been working on this for days now and can't seem to work it out.


    I followed the instructions for Mounting network shares for OpenELEC since I read multiple times that this would also work on LibreELEC. I created a *.mount file for each NFS share I want to mount just as described there using the hostname for the NFS share path and tried several things:

    1. Mounting during runtime using systemd: systemctl start storage-backup.mount
    2. Mounting during runtime using mount: mount -t nfs <nfs share path using hostname> /storage/backup/ -o nolock
    3. Enabling mounting on startup (boot) using systemd: systemctl enable storage-backup.mount

    Of course I used systemctl daemon-reload when it was necessary.


    The first two methods work flawlessly (not depending on whether I use hostname or IP address in the NFS share path). The third one, however, finishes without any errors but if I reboot the path(s) are not mounted.


    Here are my specs:

    • Kodi version: Kodi 17.5 Git:5bd45ab compiled on Oct 29 2017
    • OS: LibreELEC (official): 8.2.0.1 (kernel: Linux 4.9.59, architecture: RPi2.arm)
    • Hardware: Raspberry Pi 3 Model B Rev 1.2
    • NFS share provided by: QNAP TS659 with firmware version 4.2.6 Build 20171026


    Does anyone know why the mount won't take place during boot and how to fix it?



    EDIT 1:

    It is even worse. I disabled all symlinks for systemd mounts and tried again with only one. After the first reboot everything was fine. The folder was mounted. On the next reboots the mount disappeared again even if I enabled it again before the next reboot. It just doesn't want to come (back) up. But the symlink persists in ~/.config/system.d/multi-user.target.wants.


    I definitely don't know how to help myself anymore. This feels oddly random and strange.



    EDIT 2:

    I just found this using either systemctl status storage-backup.mount or journalctl -x:

    Code
    Nov 12 13:55:31 KodiWohn systemd[1]: storage-backup.mount: Mount process exited, code=exited status=110
    Nov 12 13:55:31 KodiWohn systemd[1]: Failed to mount storage/backup.Folder.
    Nov 12 13:55:31 KodiWohn systemd[1]: storage-backup.mount: Unit entered failed state.

    So it does actually try to mount the unit (meaning it ist truely enabled) but it does fail on doing so. Why is that?

    Edited 6 times, last by Plutoschaf ().

  • I have never had to do anything special to mount my nfs on an LE installation. I go to Kodi files to add sources and my nfs is there. I have a qnap TS-439 Pro II. Of course I have set up my qnap to be available to anyone on the local network.

  • That's not what I am aiming for. I don't want to use Kodi's ability to add sources from NFS shares. I want the OS to do it and only tell Kodi which "local folders" it should look in so switching the actual source is nothing kodi needs to bother about but only the path mounted to the folder kodi is watching.


    I hope this solution preserves episode bookmarks when switching from SMB to NFS or vice versa or to any other possibility.

  • I know this is an old thread, but I'm in the same boat. Is there an easy way to mount NFS shares at boot?

  • My NFS shares mount by themselves - they are set as sources in LE and it just works. Here's how my /storage/.kodi/userdata/sources.xml looks like:

    I am using the IP instead of the DNS name of the internal file server for database compatibility reasons (12 years worth of videos there and I don't want to mess with the DB by changing the IP to DNS name and having to reindex everything). This shouldn't be a problem, though.

  • Thanks, will look into this. I have the same situation, there is a remote database and I do not want to bork it.

  • In fstab, i have the below setting (be sure to create a full backup first -- mess up fstab tough to recover). This assume a share is set at /media/UBS1.


    I should add this is on a RasPi, Raspbian. So it may not apply to your situation.



    Code
    /dev/sda1 /media/USB1 -t ntfs-3g defaults,nofail,x-systemd.device-timeout=1 0 0 


    Note: i had to remove "usbmount =sudo apt-get remove usbmount"

  • Hi


    I recently added some NFS mounts at boot for my LE system. I also followed the OE link, this worked for me:


    Configure the mount by creating this file with nano or equivalent:


    LibreELEC:~ # cat /storage/.config/system.d/storage-data2-video.mount

    [Unit]

    Description=test nfs mount script

    Requires=network-online.service

    After=network-online.service

    Before=kodi.service


    [Mount]

    What=192.168.1.11:/usr/data2/video

    Where=/storage/data2/video

    Options=

    Type=nfs


    [Install]

    WantedBy=multi-user.target

    LibreELEC:~


    Then start it to test:


    LibreELEC:~ # systemctl start storage-data2-video.mount


    If ok then enable the mount to start on boot:


    LibreELEC:~ # systemctl enable storage-data2-video.mount


    paul

    Edited once, last by Pshepherd ().

  • I mount my NFS share before Kodi starts so that it can read symlinks from the folder. You can mount drives with /storage/.config/autostart.sh


    Mine for example shows:

    #!/bin/sh

    mount -t nfs 192.168.1.199:/mnt/user/XBMC /storage/xbmc -o nolock;



  • Had the same issue, found the solution:


    Remove the following lines from the *.mount files.

    Code
    Requires=network-online.service
    After=network-online.service

    I believe that the service is waiting until network-online.service loads, but since it is never used, it never loads the mount. This allowed my NFS shares to work correctly.