Mounting NAS using fstab causes timing issues

Quick to answer questions about finding your way around Linux Mint as a new user.
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. Stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions use the other forums in the support section.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
LegacyMJR

Mounting NAS using fstab causes timing issues

Post by LegacyMJR »

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!
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Mattyboy

Re: Mounting NAS using fstab causes timing issues

Post by Mattyboy »

Use the

Code: Select all

mount -a
as a custom command in start up applications and set a suitable time delay?
altair4
Level 20
Level 20
Posts: 11454
Joined: Tue Feb 03, 2009 10:27 am

Re: Mounting NAS using fstab causes timing issues

Post by altair4 »

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 20
Level 20
Posts: 12212
Joined: Sun Mar 27, 2016 6:58 pm

Re: Mounting NAS using fstab causes timing issues

Post by rene »

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 20
Level 20
Posts: 11454
Joined: Tue Feb 03, 2009 10:27 am

Re: Mounting NAS using fstab causes timing issues

Post by altair4 »

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.
Locked

Return to “Beginner Questions”