salexes
(Salexes)
April 17, 2020, 6:47pm
1
Hello guys,
I want to mount my NAS via cifs automatically after reboot of the raspberry pi.
I am running openhabian on a rpi4.
This is my current approach:
rule"mounting test"
when
System started
then
logInfo("System Start", "Rule Systemstart executed ")
executeCommandLine("mount -t cifs //192.168.1.200/Data/ -o username=admin,password=PASSWORD /etc/openhab2/mnt/nas")
logInfo("System Start", "Mount command executed ")
end
But nothing gets mounted. What am I doing wrong ?
rossko57
(Rossko57)
April 17, 2020, 6:53pm
2
It might tell you…
val results = executeCommandLine("mount ...")
logInfo("System Start", "Mount command result: " + results)
salexes
(Salexes)
April 17, 2020, 6:58pm
3
2020-04-17 20:57:22.217 [INFO ] [.smarthome.model.script.System Start] - Mount command result: null
Still no idea how to make it work, since it doesn’t give me much information
rossko57
(Rossko57)
April 17, 2020, 7:37pm
4
Not much use,is it. Usually this is permissions problems.
EdwardV
(Edward Voermans)
April 17, 2020, 7:40pm
5
Why would you want to do the actual mount in a rule? Makes more sense to just mount the share during the startup of the Pi.
Best,
E
rossgb
(Ross Brown)
April 17, 2020, 7:44pm
6
It’s probably easier to use fstab to mount the share on boot instead of using an openHAB rule.
e.g.:
salexes
(Salexes)
April 17, 2020, 7:46pm
7
Just did exactly that. Works flawlessly.
Thank you guys for the quick help.
mstormi
(Markus Storm)
April 17, 2020, 7:57pm
8
But it’s a bad idea to use CIFS to share a disk FROM a Linux (your NAS) TO another Linux (your openhabian box).
Use NFS instead.
salexes
(Salexes)
April 17, 2020, 8:02pm
9
How would the command need to look like?
Couldn’t get it working with NFS.
I have a QNAP nas.
mstormi
(Markus Storm)
April 17, 2020, 9:48pm
10
Essentially use nfs in fstab instead of cifs, and don’t forget to enable and export (allow access) on your NAS. But that’s out of our scope here so please g**gle yourself.
2 Likes