1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

periodicaly try to (re)mount cifs?

Discussion in 'Tomato Firmware' started by hpsmartyz, Jan 4, 2009.

  1. hpsmartyz

    hpsmartyz LI Guru Member

    Hi all,

    I have a Synology connected to my 54gl and I have configured a cifs mount.
    The thing which is causing me problems is that in case of power failure both devices will reboot and the Syno boots slower than the 54gl causing a mount error on the 54gl.

    Is there a way to ask my 54gl to periodically try to mount the cifs if it failed at boot
    and stop trying when the mount is operational?

    many thanks for your help.

    happy new year to you all

    :)
     
  2. Slimey

    Slimey Network Guru Member

    hmm would it be possible to increase the boot_wait on the router to something that will allow the router to start after the other device has?
     
  3. hpsmartyz

    hpsmartyz LI Guru Member

    Hi,

    thanks for your answer.
    Is this a question to me or a suggestion that I should follow? :)
    If the latter, it could indeed be a potential solution yet I have other devices attached to the router, all depending on it and would prefer that the router reboots as quickly as possible, the NAS taking quite some time to completly boot.
    By the way, I do not know how to increase the boot_wait

    Would it be possible to have a small cron task running every, let's say 5s, which tests the mount, if fails tries to mount, if fails then ends, if succeeds then remove the crontab entry?
    If so
    which would be the best way to test the mount and what is the mount command (though I think I have seen this second command in one of the threads about CIFS)?

    thx.
     
  4. HennieM

    HennieM Network Guru Member

    Best way would probably be to put a portion at the end of your startup script to try the mount say every 30 seconds. Something like this:
    Code:
    ..
    .. rest of startup script (if any)
    ..
    while [ - z "`mount | grep cifs`" ]; do
      mount <your cifs mount parameters>
      sleep 30
    done
     
  5. hpsmartyz

    hpsmartyz LI Guru Member

    Hi,

    thanks for this.
    I'll try and will provide feedbacks.
    One small question still, should I remove/disable the CIFS configuration on the admin i/f ?
    Thx

    :)
     
  6. hpsmartyz

    hpsmartyz LI Guru Member

    Hi,

    after a while ...
    here is my init script:

    Code:
    if [ -z "`pidof cifsoplockd`" ]; then
            insmod cifs
    fi
    while [ -z "`mount | grep cifs1`" ]; do
            mount -t cifs [I]aname[/I] /cifs1 -o unc=\\\\[I]ddd[/I].[I]ddd[/I].[I]ddd[/I].[I]ddd[/I]\\[I]sharedrive[/I],username=[I]ausername[/I],password=[I]apassword[/I]
            sleep 15
    done
    
    and it seems to work like a charm.

    By the way, I disabled CIFSs 1 and 2 in the GUI.
    An nvram query shows them both disabled : cifsX=0<\\......

    Thanks.
     
  7. hpsmartyz

    hpsmartyz LI Guru Member

    Hello,

    I have just upgraded to 1.27 an I am encountering problems.
    I would really welcome some help.
    The script simply does not works anymore. More precisely when I try to do it manually I get an error at:
    Code:
    insmod cifs
    It returns: insmod: can't insert 'cifs': Operation not permitted

    Would you know the reason for that?
    Note that the cifs is disabled in the GUI but this was already the case before and was working (at each reboot of the rooter).

    When enabling cifs via the GUI everything works perfectly, so I guess there are more commands via the GUI than simply insmoding cifs.
    Thanks
     
  8. rhester72

    rhester72 Network Guru Member

    If you do a lsmod, does it show as already loaded?

    Rodney
     
  9. hpsmartyz

    hpsmartyz LI Guru Member

    hello,

    thanks for your answer.
    no it does not (if of course cifs is not enabled in the GUI).

    It appears thus that enabling cifs in the GUI does more than simply insmod cifs (and then mounting the drive).
     
  10. rhester72

    rhester72 Network Guru Member

    If you insmod the _entire_ path to the .ko (including the filename itself) rather than the shortname, does it help?

    Rodney
     
  11. teddy_bear

    teddy_bear Network Guru Member

    Try modprobe instead of insmod.
    AFAIR the busybox in vanilla 1.27 has a bug requiring full path to the module to be specified for insmod command. modprobe should work fine without it.
     
  12. hpsmartyz

    hpsmartyz LI Guru Member

    great! it works!
    Thank you very much to both of you.
    Sorry I could not test sooner.

    by the way, what would have been to full path the to the .ko for CIFS?
    Thanks
     

Share This Page