Mounting NAS using fstab causes timing issues

All Gurus once were Newbies
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Please stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions prefer the other forums within the support section.
Before you post please read how to get help
Post Reply
LegacyMJR
Level 1
Level 1
Posts: 16
Joined: Sat Aug 08, 2015 6:34 am

Mounting NAS using fstab causes timing issues

Post by LegacyMJR » Mon Mar 19, 2018 7:47 pm

Have added a line to fstab to mount my NAS as below:

//192.168.0.12/Public /home/mike/Nas cifs rw,guest,vers=1.0,iocharset=utf8,_netdev,noperm 0 0

The _netdev bit allegedly) is to make the system wait until the network is up before attempting the mount.

If I am using the wired network it mounts fine. If I am on wireless (which takes longer to initialise) it does not mount and I have to do a mount -a to make it happen.

Any ideas. Or should I post somewhere else, but I am a newbie!

Mattyboy
Level 6
Level 6
Posts: 1196
Joined: Thu Mar 26, 2015 2:17 pm

Re: Mounting NAS using fstab causes timing issues

Post by Mattyboy » Mon Mar 19, 2018 11:58 pm

Use the

Code: Select all

mount -a
as a custom command in start up applications and set a suitable time delay?

altair4
Level 19
Level 19
Posts: 9549
Joined: Tue Feb 03, 2009 10:27 am

Re: Mounting NAS using fstab causes timing issues

Post by altair4 » Tue Mar 20, 2018 6:48 am

Just a suggestion on the use of Startup Applications: What you might want to do is change your fstab line to this:
//192.168.0.12/Public /home/mike/Nas cifs rw,guest,vers=1.0,iocharset=utf8,_netdev,noperm,noauto,user 0 0
noauto will prevent the mount from happining at boot time.
user will allow an ordinary ( non root ) user to mount the share.

Then in Startup Applications add:

Code: Select all

mount /home/mike/Nas
An alternative method is:

** Keep your current fstab line as it is.
** Create a new file at /etc/network/if-up.d/fstab

With these lines:

Code: Select all

#!/bin/sh
mount -a
** Then make the file executable:

Code: Select all

sudo chmod +x /etc/network/if-up.d/fstab
Anything added to if-up.d will execute only after the network is up in the boot process.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.

rene
Level 10
Level 10
Posts: 3255
Joined: Sun Mar 27, 2016 6:58 pm

Re: Mounting NAS using fstab causes timing issues

Post by rene » Tue Mar 20, 2018 7:09 am

So as to avoid such issues it is advised to "automount" network file systems; this is to say that they mount only when in fact accessed (and can automatically unmount after laying idle for some specified time again). If you're on Mint 18 you can do this directly from /etc/fstab:

Code: Select all

//192.168.0.12/Public /home/mike/Nas cifs noauto,rw,guest,vers=1.0,iocharset=utf8,noperm,x-systemd.automount,x-systemd.device-timeout=10s,x-systemd.idle-timeout=10m
Also see man systemd.mount. If you do not in fact need the NAS mounted immediately when booting this'll work nicely.

altair4
Level 19
Level 19
Posts: 9549
Joined: Tue Feb 03, 2009 10:27 am

Re: Mounting NAS using fstab causes timing issues

Post by altair4 » Tue Mar 20, 2018 7:43 am

altair4 wrote:
Tue Mar 20, 2018 6:48 am
Just a suggestion on the use of Startup Applications: What you might want to do is change your fstab line to this:
//192.168.0.12/Public /home/mike/Nas cifs rw,guest,vers=1.0,iocharset=utf8,_netdev,noperm,noauto,user 0 0
noauto will prevent the mount from happining at boot time.
user will allow an ordinary ( non root ) user to mount the share.

Then in Startup Applications add:

Code: Select all

mount /home/mike/Nas
Um ... Actually ... and this depends on how you use the NAS device ... you really don't have to use Startup Applications at all.

Your mount point is in your home directory so if you add noauto and user to your fstab line you will get a mount icon on the side panel of your file manager which becomes actionable. Click on the icon and your share is mounted seamlessly.

It's easy enough to try:

** Unmount your share:

Code: Select all

sudo umount /home/mike/Nas
** Add noauto and user to your list of options in fstab.
** On the side panel of your file manager you should see something labelled Nas - under Network if you are using Nemo.
** If you click on it it will go to fstab to find out if you can mount it ( user ) and how to mount it and it will mount.

If you only use the nas when needed this is an option.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.

Post Reply

Return to “Newbie Questions”