[SOLVED] Correct fstab entry to mount my NAS

Forum rules
Before you post please read this
Post Reply
LegacyMJR
Level 1
Level 1
Posts: 16
Joined: Sat Aug 08, 2015 6:34 am

[SOLVED] Correct fstab entry to mount my NAS

Post by LegacyMJR » Thu Apr 26, 2018 7:20 pm

I have finally dumped all of my Windows systems and moved them all onto Linux Mint. Having solved the nonsense that is getting a modern all-in-one printer scanner to function I have now moved onto connecting my NAS. My problem is the age-old one of not mounting at boot time. If I issue a sudo mount -a once the system is up it mounts fine but never at boot. My fstab entry is shown below. What is wrong with it please.

# mount my Nas
//192.168.0.12/Public /home/mike/Nas cifs rw,guest,vers=1.0,iocharset=utf8,_netdev,noperm 0 0
Last edited by LegacyMJR on Wed Jul 04, 2018 2:28 pm, edited 1 time in total.

User avatar
AndyMH
Level 5
Level 5
Posts: 605
Joined: Fri Mar 04, 2016 5:23 pm
Location: Wiltshire

Re: Correct fstab entry to mount my NAS

Post by AndyMH » Fri Apr 27, 2018 3:34 am

Homebrew i5-8400+GTX1080 Cinnamon 19, Thinkpad T430 i7-3632 Cinnamon 18.3, Thinkpad T420 Cinnamon 18.3, Thinkpad T410 Cinnamon 17.3, Thinkpad T60 19.0 Mate

LegacyMJR
Level 1
Level 1
Posts: 16
Joined: Sat Aug 08, 2015 6:34 am

Re: Correct fstab entry to mount my NAS

Post by LegacyMJR » Fri Apr 27, 2018 4:44 am

Why would I do that it does not answer my question?

User avatar
AndyMH
Level 5
Level 5
Posts: 605
Joined: Fri Mar 04, 2016 5:23 pm
Location: Wiltshire

Re: Correct fstab entry to mount my NAS

Post by AndyMH » Fri Apr 27, 2018 6:36 am

If you want to auto mount your NAS you will have to supply username and password, the link gives you the syntax. My NAS is mounted in fstab as

Code: Select all

# mount point for synology NAS used in rsync backups
192.168.0.5:/volume1/homes/andy/backups /media/andy/diskstation nfs rw,noauto,user,nofail 0 0
but with NOAUTO so it doesn't mount automatically.
Homebrew i5-8400+GTX1080 Cinnamon 19, Thinkpad T430 i7-3632 Cinnamon 18.3, Thinkpad T420 Cinnamon 18.3, Thinkpad T410 Cinnamon 17.3, Thinkpad T60 19.0 Mate

LegacyMJR
Level 1
Level 1
Posts: 16
Joined: Sat Aug 08, 2015 6:34 am

Re: Correct fstab entry to mount my NAS

Post by LegacyMJR » Fri Apr 27, 2018 6:48 am

It does not have/need a username or password and the whole point is that it is not auto mounting.

That is the whole problem - the sheer amount of questions and answers on this topic show its a can of worms.

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

Re: Correct fstab entry to mount my NAS

Post by altair4 » Fri Apr 27, 2018 6:53 am

This issue is fstab is executed before the network stack it up in Mint. I'll give you some possible options:

[1] Change the way you mount it.

This depends on how you use your share. What I am suggesting is not mounting at boot but mounting it when you need it. If you change your fstab statement to this:
//192.168.0.12/Public /home/mike/Nas cifs rw,guest,vers=1.0,iocharset=utf8,_netdev,noperm,noauto,user 0 0
A mount icon will show up on the side panel of your file manager. Click on it and it will look to fstab to find out how to mount it. You can use the same icon to unmount it if desired.

[2] Mount it via /etc/rc.local by adding a line to it above the exit 0 line:

[2a] Keep your line in fstab as you originally had it then add mount -a to rc.local

[OR 2b] Remove the line in fstab and add a mount in rc.local:

Code: Select all

mount -t cifs //192.168.0.12/Public /home/mike/Nas -o rw,guest,vers=1.0,iocharset=utf8,_netdev,noperm
[3] Add a file to /etc/network/if-up.d/

** Create a script:

Code: Select all

gksu xed /etc/network/if-up.d/fstab
** With this content:

Code: Select all

#!/bin/sh
mount -a
** Make it 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 stack is operational.

EDIT FOR MINT19 USERS
: If you want to use the rc.local method you need to enable it first:

The rc-local service already exists ( systemctl cat rc-local.service ) all it needs is an rc.local file:

Code: Select all

sudo touch /etc/rc.local
That is executable:

Code: Select all

sudo chmod +x /etc/rc.local
And has at least this contents:

Code: Select all

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

### Add terminal commands below this line and before "exit 0":

exit 0
Then reboot. When you log in again make sure the rc-local service is running:

Code: Select all

sudo systemctl status rc-local
Last edited by altair4 on Fri Aug 03, 2018 2:24 pm, edited 6 times in total.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.

User avatar
smurphos
Level 7
Level 7
Posts: 1600
Joined: Fri Sep 05, 2014 12:18 am
Location: Britisher...

Re: Correct fstab entry to mount my NAS

Post by smurphos » Fri Apr 27, 2018 7:13 am

altair4 wrote:
Fri Apr 27, 2018 6:53 am
This issue is fstab is executed before the network stack it up in Mint.
Does the _netdev option not cover this anymore? I used to mount a samba share on boot with the fstab line below and it worked flawlessly - this was 18.x Cinnamon with a share on 18.x XFCE. I stopped using Samba when all of the 'Eternal Blue' SMBv1 stuff was going on.

//192.168.1.3/shared_storage /mnt/plex_server_drive cifs uid=steve,credentials=/home/steve/.smbcredentials,iocharset=utf8,sec=ntlm,_netdev,nofail 0 0

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

Re: Correct fstab entry to mount my NAS

Post by altair4 » Fri Apr 27, 2018 7:37 am

I just realized you asked this same question before and I gave you the same response. You even got the systemd option that member rene posted:
rene wrote:
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.
Oh well ....
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.

LegacyMJR
Level 1
Level 1
Posts: 16
Joined: Sat Aug 08, 2015 6:34 am

Re: Correct fstab entry to mount my NAS

Post by LegacyMJR » Fri Apr 27, 2018 7:42 am

Quote "
Re: Correct fstab entry to mount my NAS
Post by altair4 » Fri Apr 27, 2018 9:53 am

This issue is fstab is executed before the network stack it up in Mint. I'll give you some possible options:

[1] Change the way you mount it.

This depends on how you use your share. What I am suggesting is not mounting at boot but mounting it when you need it. If you change your fstab statement to this:
//192.168.0.12/Public /home/mike/Nas cifs rw,guest,vers=1.0,iocharset=utf8,_netdev,noperm,noauto,user 0 0
A mount icon will show up on the side panel of your file manager. Click on it and it will look to fstab to find out how to mount it. You can use the same icon to unmount it if desired.
"

Thanks tried your option 1 - this means when I double click on my Nas directory it mounts. For me this is a good solution.

So THANKS VERY MUCH!!

LegacyMJR
Level 1
Level 1
Posts: 16
Joined: Sat Aug 08, 2015 6:34 am

Re: Correct fstab entry to mount my NAS [SOLVED]

Post by LegacyMJR » Fri Apr 27, 2018 7:44 am

SORRY FORGOT TO POST SOLVED

User avatar
catweazel
Level 17
Level 17
Posts: 7497
Joined: Fri Oct 12, 2012 9:44 pm
Location: Australian Antarctic Territory

Re: Correct fstab entry to mount my NAS

Post by catweazel » Fri Apr 27, 2018 7:44 am

AndyMH wrote:
Fri Apr 27, 2018 6:36 am
If you want to auto mount your NAS you will have to supply username and password
Nonsense.
¡uʍop ǝpısdn sı buıɥʇʎɹǝʌǝ os ɐıןɐɹʇsnɐ ɯoɹɟ ɯ,ı

User avatar
catweazel
Level 17
Level 17
Posts: 7497
Joined: Fri Oct 12, 2012 9:44 pm
Location: Australian Antarctic Territory

Re: Correct fstab entry to mount my NAS [SOLVED]

Post by catweazel » Fri Apr 27, 2018 7:44 am

LegacyMJR wrote:
Fri Apr 27, 2018 7:44 am
SORRY FORGOT TO POST SOLVED
To mark the thread solved, please edit the subject line of your first post in the thread.
¡uʍop ǝpısdn sı buıɥʇʎɹǝʌǝ os ɐıןɐɹʇsnɐ ɯoɹɟ ɯ,ı

Post Reply

Return to “Mounting Partitions”