CIFS Mount External Share - Code for Lua start up.

Can you try the "df" command after rebooting and a reload as suggested, and see if that brings us some good s=diagnostic information?

Did the reboot but same result…

root@MiOS_30102864:~# df Filesystem 1K-blocks Used Available Use% Mounted on /dev/root 4608 4608 0 100% /rom tmpfs 63728 556 63172 1% /tmp tmpfs 512 0 512 0% /dev /dev/mtdblock7 11264 2928 8336 26% /overlay overlayfs:/overlay 11264 2928 8336 26% / /dev/sda1 61481 20209 38097 35% /tmp/log/cmh /dev/mtdblock8 6528 6528 0 100% /mios df: /qnap: Value too large for defined data type root@MiOS_30102864:~# mount rootfs on / type rootfs (rw) /dev/root on /rom type squashfs (ro,relatime) proc on /proc type proc (rw,noatime) sysfs on /sys type sysfs (rw,noatime) tmpfs on /tmp type tmpfs (rw,nosuid,nodev,noatime) tmpfs on /dev type tmpfs (rw,noatime,size=512k,mode=755) devpts on /dev/pts type devpts (rw,noatime,mode=600) /dev/mtdblock7 on /overlay type jffs2 (rw,noatime) overlayfs:/overlay on / type overlayfs (rw,noatime,lowerdir=/,upperdir=/overlay) debugfs on /sys/kernel/debug type debugfs (rw,relatime) /dev/sda1 on /tmp/log/cmh type ext3 (rw,noatime,nodiratime,errors=continue,barrier=0,data=ordered) /dev/mtdblock8 on /mios type squashfs (ro,relatime) none on /proc/bus/usb type usbfs (rw,relatime) //192.168.1.16/Vera on /qnap type cifs (rw,mand,relatime,unc=\\192.168.1.16\Vera,username=Vera,uid=0,noforceuid,gid=0,noforcegid,addr=192.168.1.16,file_mode=0755,dir_mode=0755,rsize=16384,wsize=57344,actimeo=1)

Hans

I really have no idea. We need a Unix expert. What is the NAS drive are you mounting?

It is a Qnap raid system with 4 disks, 5tb netto space.

can’t you just put both folders in the same path on the nas, then add the mount point to the actual config, so mount \nas\share on /nas and then add /nas/datamine and /nas/datayours in the config of each plugin

like :
-|nas
-|share
-|datayours
-|datamine
this way you only mount 1 directory but with 2 folders in it.

[quote=“n0ir, post:20, topic:181206”]Is it possible to use this startup Lua to mount TWO paths? I want to mount both a path for datamine and datayours.

Tried to just add another block of text in the end but after a reboot only one path was remounted (datamine):[/quote]

This should work just fine if your remove the [tt]retry[/tt] option (I don’t think I’ve ever needed it anyway) and remember to insert another call to [tt]cifsmount[/tt]

local device = "//192.168.1.1/16gbusb/datayours"
local directory = "/datayours"
local user = ""
local pass = ""

cifsmount {user=user, pass=pass, device=device, directory=directory} 

local device = "//192.168.1.1/16gbusb/datamine"
local directory = "/datamine"
local user = ""
local pass = ""

cifsmount {user=user, pass=pass, device=device, directory=directory} 

Great! Realised I just could use one directory on my Vera (/nas) and have two subfolders, one for datamine (/nas/datamine) and one for datayours (/nas/datayours). The command mount a subfolder (192.168.1.1/usb/vera) from my routers attached USB stick to this location.

Will see if it works properly.

I also have the “df: /nas: Value too large for defined data type”. I am linking to my file server, something around 15TB now…

Any other options for this?

Hi,

After the last two UI7 firmware updates I found two issues;

  1. The cifs package is gone so mounting fails.
  2. The mount point directory is gone so mounting fails.

So I added a check for the directory to the script and if it no longer exists reinstall the cifs package and recreate the directory.
This are the lines I added to akbooers cifsmount script, all with the os.execute(…
– First assure we have the mount folder as UI7 updates clear it. When not there also assume the cifs packages are required
os.execute((“[ ! -d %s ] && opkg update”):format(x.directory))
os.execute((“[ ! -d %s ] && opkg install --force-depends kmod-fs-cifs”):format(x.directory))
os.execute((“[ ! -d %s ] && mkdir %s”):format(x.directory, x.directory))
– Resume akbooers script.
local cmd = (“mount -t cifs -o user=‘%s’,password=‘%s’,nounix,noserverino %s %s”): format (x.user, x.password, x.device, x.directory)
local ok, term, status = os.execute (cmd)

I must admit I am not 100% sure it will do the trick after the next firmware, because I’ll have to wait for that to show up next month(?), but at least it does not hurt anything when the directory is existing ;D

Cheers Rene

[quote=“reneboer, post:28, topic:181206”]After the last two UI7 firmware updates I found two issues;

  1. The cifs package is gone so mounting fails.
  2. The mount point directory is gone so mounting fails.[/quote]
    Yes, it’s a real pain - stops lots of things working.
-- Resume akbooers script. local cmd = ("mount -t cifs -o user='%s',password='%s',nounix,noserverino %s %s"): format (x.user, x.password, x.device, x.directory)
I have to say that these days, I've found I need to use a different command line for a successful mount (at least on UI7) otherwise I get "missing device" [tt] local cmd = ("mount -t cifs -o user='%s',password='%s',[b]sec=ntlm[/b] %s %s"): format (x.user, x.password, x.device, x.directory) [/tt]

Couldn’t say whether your fix will work - let’s wait and see - but these things can be tough to get right in all circumstances.

Thanks anyway for pointing out a problem and possible solution.

[quote=“akbooer, post:29, topic:181206”]I have to say that these days, I’ve found I need to use a different command line for a successful mount (at least on UI7) otherwise I get “missing device”
[tt]
local cmd = (“mount -t cifs -o user=‘%s’,password=‘%s’,sec=ntlm %s %s”): format (x.user, x.password, x.device, x.directory)
[/tt][/quote]
For me it still works without the sec parameter. However, when I look at the mount output I do see that sec=ntlmssp seems to be included by default. I did find this [url=http://ubuntuforums.org/showthread.php?t=2230952]Why do I have to use sec=ntlm to get CIFS shares mounted? this parameter and it looks like the age of the firmware on your NAS will play a role as well as the OpenWRT version (hence a difference be tween UI5 and latest UI7?).

Cheers Rene

After a lot of reading in this forum and trial and error I have Datayours working with a CIFS mount to my Synology NAS. As long as my VERA is not powered off this is working.
The only thing I cannot get to work is the code for Lua start up…
I tried some code that is posted in this topic.

At first the extended code of akbooer in reply #7 (July 12 2014). I got no error message but after my VERA was powered off the mount was not re-installed. So this didn’t work…
Then I used the short code of akbooer in reply #24 (april 8 2015) and then only the first part (because on this Vera I only use Datayours):

local device = “//192.168.1.9/vera
local directory = “/nas”
local user = “user”
local pass = “pass”

cifsmount {user=user, pass=pass, device=device, directory=directory}

(for user and pass I used off course my personal logins for my Synology; "vera"is the name of the share on my Synology where the Datayours data are logged)

But now I get an error message: “Error in lua for scenes and events”

I don’t know what is wrong…

It concerns a Vera 3 on UI5-672

Who can help me in this ?

You haven’t deleted the definition of the cifsmount function, have you? There should be an error message in the log which more fully describes the error.

@akbooer

Thanks for your quick reaction. I indeed deleted the cifsmount function. Did not read the code well, just copy and paste… pretty stupid of me… :-[ Now I think it’s complete and working. I will soon test it by powering off the Vera.

[quote=“reneboer, post:28, topic:181206”]Hi,

After the last two UI7 firmware updates I found two issues;

  1. The cifs package is gone so mounting fails.
  2. The mount point directory is gone so mounting fails.

So I added a check for the directory to the script and if it no longer exists reinstall the cifs package and recreate the directory.
This are the lines I added to akbooers cifsmount script, all with the os.execute(…
– First assure we have the mount folder as UI7 updates clear it. When not there also assume the cifs packages are required
os.execute((“[ ! -d %s ] && opkg update”):format(x.directory))
os.execute((“[ ! -d %s ] && opkg install --force-depends kmod-fs-cifs”):format(x.directory))
os.execute((“[ ! -d %s ] && mkdir %s”):format(x.directory, x.directory))
– Resume akbooers script.
local cmd = (“mount -t cifs -o user=‘%s’,password=‘%s’,nounix,noserverino %s %s”): format (x.user, x.password, x.device, x.directory)
local ok, term, status = os.execute (cmd)

I must admit I am not 100% sure it will do the trick after the next firmware, because I’ll have to wait for that to show up next month(?), but at least it does not hurt anything when the directory is existing ;D

Cheers Rene[/quote]
I just upgraded to 7.0.11 after skipping 7.0.10 and I can confirm this is working. After the upgrade the cifs package got reinstalled and the mount was successful after a second reboot.

Cheers Rene

I upgraded to UI7 a while ago and just recently noticed my Data Yours wasn’t working. Turns out it was because my NAS wasn’t being mounted properly.

I added the lines to install the CIFS package and to auto-create the folder but am still having problems. I’ve been doing troubleshooting from an SSH session to try to simplify things.

When I run “opkg install --force-depends kmod-fs-cifs” it tells me that the package version 2.6.37.1-1 is installed an up to date. So that’s good. I have also verified that the local mount directory (/NAS1) is there. I guess the script ran properly for those pieces.

The problem is when I run “mount -t cifs -o user=XXX,password=YYY,nounix,noserverino //IPofNAS/share /NAS1” I get the error message:
mount: mounting //IPofNAS/share on /NAS1 failed: No such file or directory

I have verified from a Windows 7 box that I can access the share on the NAS using the specified username/password. I have also tried using the “sec=ntlm” option mentioned earlier in this thread but I get the same error.

If I try running the mount command with known bad values for the NAS share or the local mount directory I get the same error message. So I’m not sure which side the issue is on.

My NAS is a QNAP running firmware 4.1.1 which is from a year ago. There’s a few newer ones and I’ll probably upgrade soon regardless of this issue.

Any tips are much appreciated.

Thanks

Hi Craig,

I am having the same issue with my VeraLite that I just upgraded to UI7.12. On my Edge it works just fine and with UI6 it worked as well on the Lite. Go figure. Suggestions are welcome.

Cheers Rene

I’ve had some trouble maintaining my NAS mount on UI5. Here’s that section of my startup LUA:

[code]-- cifs mount for use during startup

local function df ()
local info
local p = io.popen (“df”,‘r’)
if p then info = p:read “*a”; p:close () end
return info
end

function cifsmount (x)
local function log (msg) luup.log ((“cifsmount: ‘%s’ %s”): format (x.device or ‘?’, msg)) end
local df = df ()
if df: find (x.device, 1, true) then
log “already mounted”
else
local cmd = (“mount -t cifs -o user=%s,pass=%s,nounix,noserverino %s %s”): format (x.user, x.pass, x.device, x.directory)
local ok, term, status = os.execute (cmd)
log ("mounted status: "…tostring(status))
if ok
then log ("mounted OK: "…tostring(ok))
elseif x.retry then luup.call_delay (“cifsmount”, 60 * x.retry)
else log “failed to mount”
end
end
end

local device = “//10.0.0.7/Vera
local directory = “/nas”
local user = “xxxxx”
local pass = “xxxxx”[/code]

So what’s the problem?

And where is the actual call to the cifsmount function ?

[quote=“akbooer, post:38, topic:181206”]So what’s the problem?
And where is the actual call to the cifsmount function ?[/quote]
I can mount manually, but after some time… no NAS. Am I missing the call? This is the only section in my startup Lua that references cifs. I’m not a developer, if that’s not obvious…!

There should be a line at the bottom of it all that says this

cifsmount {user=user, pass=pass, device=device, directory=directory} 

Otherwise the manual mount would go away after a restart.