02-08-2021 05:48 PM - edited 02-08-2021 05:51 PM
Hi All
Hopefully a simple question but I'm hoping someone here can help.
I'm using an NI Industrial Controller
I've followed the following instruction on how to mount to a shared network drive, and all looks good.
Mounting and Logging to a Network Attached Storage (Network Drive) - National Instruments (ni.com)
However I want the mount to persist after a reboot. If I reboot I lose the mounting and I have to go and create it again.
Muchos Kudos for any help
Cheers
Kurt
02-08-2021 06:03 PM
You'll want to look into the /etc/fstab file which defines filesystems that are mounted at boot time. Since you don't give a lot of detail on the type of network drive you're mounting I can't volunteer an example, but it's pretty straight-forward if you look at the generic Linux documentation for that file and what it's used for.
02-08-2021 06:19 PM - edited 02-08-2021 06:26 PM
Thanks Charlie
Only knowing enough Linux to be dangerous I might need a bit more hand holding, I saw the sftab file is the likely place to do this but also that if I edit it incorrectly then I may prevent my Industrial controller from booting up.
So the command I am using to mount is basically of the form
mount -t cifs //[IP of remote server]/[name of shared folder]/ -o username=[your username],password=[your password],uid=lvuser /home/lvuser/data
in my case
mount -t cifs //10.22.5.43/T2MTS/TestReports -o username=kurt,password=blah,uid=lvuser /home/lvuser/reports
is it a matter of just adding this as a line in the fstab file? could you point me to a useful resource?
My fstab file has the following contents
# stock fstab - you probably want to override this with a machine specific one
/dev/root / auto defaults 1 1
proc /proc proc defaults 0 0
devpts /dev/pts devpts mode=0620,gid=5 0 0
tmpfs /run tmpfs mode=0755,nodev,nosuid,strictatime 0 0
tmpfs /var/volatile tmpfs size=26% 0 0
# uncomment this if your device has a SD/MMC/Transflash slot
#/dev/mmcblk0p1 /media/card auto defaults,sync,noauto 0 0
LABEL=nibootfs /boot ext4 sync 0 0
LABEL=niconfig /etc/natinst/share ext4 sync 0 0
02-08-2021 06:44 PM
The other option is can I execute the mount command from a system exec when my LVRT application boots up?
I've tried but I get the following returned
mount: only root can use "--options" option
02-08-2021 08:41 PM
The LabVIEW Real-Time process runs as lvuser while you need root/admin privileges to mount a filesystem. This is intention and I generally wouldn't recommend changing it (though there are plenty of posts on this forum explaining how to do so and plenty of use cases where it does make sense to run commands as root from LabVIEW).
For adding to fstab, this page seems to be a reasonable overview of the columns in that file. You'll want something like this:
//10.22.5.43/T2MTS/TestReports /home/lvuser/reports cifs username=kurt,password=blah,uid=lvuser 0 0
You should definitely double-check me on that.
As for testing without a reboot, running "mount -a" should attempt to mount all unmounted files listed in fstab. I'd confirm your new line works that way before trying a reboot.
02-08-2021 08:56 PM
Thanks Charlie
Much appreciated I'll give that a try.