Mounting network shares problem

  • Hi all, I am new here. I have been trying to use the script below to mount my cifs share but to no avail. The funny thing is, the exact same script used to work when I was using Openelec. Auto mount stopped working once I perform the migration from Openelec. Grateful if some experts here can shine some light to the problem. Many thanks.

    -----------------------------------------------------------------

    # This is a sample service script to mount CIFS/SAMBA shares.

    # Please read carefully the comments in this file. For production usage

    # you can remove all comments (lines beginning with "#") from this file.


    [Unit]

    # The description should be used to explain what this servicefile is for

    Description=cifs mount script

    # if we do network mounts like here we *require* 'network-online.service'

    # which checks if the network is online

    Requires=network-online.service

    # our scripts must start *after* 'network-online.service', on timeout and if

    # 'network-online.service' fails we can not mount and this scripts fails too

    After=network-online.service

    # usually we mount networks shares because we want they avaible *before* XBMC starts.

    # so XBMC has access to this mounts from beginning. Note: this slows down the boot!

    Before=kodi.service


    [Mount]

    # The share we want mount

    What=//192.168.0.109/video/tvshows

    # Where we want mount this share

    Where=/storage/tvshows

    # Any options you usually use with the "-o" parameter in the mount command

    Options=username=xbmckodi,password=*mypassword*

    # filesystem type

    Type=cifs


    [Install]

    # The target is used by 'systemctl enable <name_of_this_file.mount>' to link

    # this service to a runlevel for starting on boot. usually 'multi-user.target'

    # is ok here.

    WantedBy=multi-user.target

    # Important:

    # this file must be renamed to <mountpoint>.mount where <mountpoint>, is the FULL path

    # where the share will be mounted but slashes "/" MUST BE REPLACED with dashes "-" with .mount

    # as extension.

    # This means, if we want mount to "/storage/music2" (see above "Where=/storage/music2")

    # then this file must be renamed to 'storage-music2.mount' and can be enabled via ssh with the

    # command 'systemctl enable storage-music2.mount'

    Edited once, last by cheungie (May 22, 2018 at 5:47 AM).

  • Did you remember to enable the mount and place it in the correct directory with the correct name.

    The name should be "storage-tvshows.mount" The path of the where with - instead of /

    And is should be in /storage/.config/system.d/

    Are your username and password the same in LE as they were in OE?

    If you modify it after enabling you need to do systemctl daemon-reload.

  • Thank you all.

    I start afresh and abandoned my old scripts. Everything is working now so I never bothered working out what went wrong with my old ones.

  • An interesting point I discovered yesterday; a local usb drive will auto magically get shared via samba after it auto magically mounts on /var/media, if you check that option in LE settings.

    Edited once, last by donbrew (May 29, 2018 at 7:08 PM).