NI Linux Real-Time Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Maintain a mount on bootup

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

0 Kudos
Message 1 of 6
(1,741 Views)

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. 

Charlie J.
National Instruments
Message 2 of 6
(1,724 Views)

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

0 Kudos
Message 3 of 6
(1,714 Views)

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

 

0 Kudos
Message 4 of 6
(1,702 Views)

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. 

Charlie J.
National Instruments
Message 5 of 6
(1,679 Views)

Thanks Charlie

 

Much appreciated I'll give that a try.

0 Kudos
Message 6 of 6
(1,674 Views)