08-02-2023 03:09 PM
I have a Network attached storage drive containing synology diskstation DS218 which is where im saving locally acquired tdms files from the cRIO to the Networked attached storage drive. To do this i use putty SSH login to the cRIO and use a manual mount command. The command is as Follows:
sudo mount -t cifs -o username=Tbg-Solutions,uid=lvuser //192.168.0.68/Data /home/lvuser/data
This works however if the cRIO is restarted then the mount location is lost and I need to remount by logging into the cRIO, is there a way to do this mount on startup. I have seen fstab file but not confident to edit this without understanding abit more im not familiar with linux operating systems any help is appreciated.
Thank you
08-02-2023 08:45 PM
Are you running your cRIO code from a connected PC? That is, when you normally start the cRIO, is it connected to the PC, you used the PC to "manually" get the cRIO to connect to the NAS, and then use the PC to start the cRIO executable? A secondary question -- if this is true, does the PC remain connected to the cRIO during its run?
If so, I'd really recommend letting the PC manage communication with the NAS. Have a small program that runs in the PC, starts the cRIO, establishes a Network Stream from the cRIO to the PC, and get the cRIO to stream its data to the PC, which then streams it to the NAS.
It's not clear to me what causes the cRIO to restart -- a crash, an error, a normal shut-down? The RIO->PC Network Stream could provide a clue (particularly if data "absence" can be noted as an "error"), which could allow the PC to "appropriately" close the NAS file and on restart, either "add on" to the incomplete file or "save as tail end of file" and have subsequent PC software "merge" the two (or three, or 17) sections.
Bob Schor
08-03-2023 02:33 AM - edited 08-03-2023 02:33 AM
Do you have to use SMB? You could potentially use WebDAV for file transfer. That way, you do not need to have an extra configuration step for the cRIO.
Mounting needs admin privileges, so editing fstab is better than adding lvuser to sudoers. I did this once and remember it was a hassle, because the network was not ready when the mount happened during init.
The nice people from HSE got a wiki entry on this, see if it helps you: https://dokuwiki.hampel-soft.com/kb/ni-rt/linuxrt/samba
In your case, this might work:
As admin, install cifs-utils:
opkg install cifs-utils
Add this line to your fstab:
//192.168.0.68/Data /mnt/smb cifs noauto,users,username=Tbg-Solutions,password=PASSWORD 0 0
Add suid bit to mount
chmod +s /sbin/mount.cifs
Now you should be able to use System Exec in your rtexe to mount the share.
08-03-2023 07:01 AM
Hi cordm,
I have edited the ftsab file please see the image below. Let me know if this looks correct.
I then used putty to add the command chmod +s /sbin/mount.cifs
then i ran the system exec vi to run a manual mount command:
mount -t cifs -o username=Tbg-Solutions,password=R4bb1ts! //192.168.0.68/Data /home/lvuser/data
which the return value shown in the image indicates its still not letting lvuser call mount?
08-03-2023 08:14 AM
as the error message says, you cannot use options, try
mount /home/lvuser/data
08-03-2023 12:47 PM
Thank you very Much
Yes this worked changed to mount /home/lvuser/data and mount was successful
thank you again