LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 02-23-2021, 12:59 PM   #1
kevindd992002
Member
 
Registered: May 2019
Posts: 30

Rep: Reputation: Disabled
NFS not automatically mounting


I use these options in my fstab:

nfs vers=4.1,intr,hard 0 0

When power goes down, there's a race condition wherein my Debian server goes up faster than my DNS server so naturally the mount will fail. But my problem is that when my DNS server is already online, my Debian server never tries to remount this NFS share. Is there any solution/workaround to this?
 
Old 02-23-2021, 01:43 PM   #2
uteck
Member
 
Registered: Oct 2003
Location: Elgin,IL,USA
Distribution: GalliumOS on Chrombook
Posts: 619

Rep: Reputation: 201Reputation: 201Reputation: 201
Instead of fstab, you could use autofs to mount the share.
https://help.ubuntu.com/community/Au...g_an_NFS_share

Or you could setup a cronjob to run a script to check the NFS mount is there every few minutes, and if not, then mount it.

Last edited by uteck; 02-23-2021 at 01:43 PM. Reason: typo
 
Old 02-23-2021, 02:02 PM   #3
ferrari
LQ Guru
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 5,138

Rep: Reputation: 980Reputation: 980Reputation: 980Reputation: 980Reputation: 980Reputation: 980Reputation: 980Reputation: 980
Stay with using fstab, but take advantage of auto-mounting with systemd.

https://wiki.archlinux.org/index.php...t_with_systemd
https://wiki.archlinux.org/index.php...b_with_systemd
 
Old 02-25-2021, 10:39 AM   #4
kevindd992002
Member
 
Registered: May 2019
Posts: 30

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by ferrari View Post
Stay with using fstab, but take advantage of auto-mounting with systemd.

https://wiki.archlinux.org/index.php...t_with_systemd
https://wiki.archlinux.org/index.php...b_with_systemd
This is exactly what I need! So what I did was this:

1. Changed my nfs mount options to:

vers=4.1,_netdev,noauto,x-systemd.automount,x-systemd.mount-timeout=10,x-systemd.idle-timeout=1min

2. Ran "systemctl daemon-reload"
3. Ran "systemctl restart remote-fs.target"
4. Ran "mount -a"
5. I even rebooted my server but when I ls the shares now, it says "cannot open directory '{mount path}': no such device"

What am I missing here?

Last edited by kevindd992002; 02-25-2021 at 10:45 AM.
 
Old 02-25-2021, 10:46 AM   #5
kevindd992002
Member
 
Registered: May 2019
Posts: 30

Original Poster
Rep: Reputation: Disabled
As soon as I modified to just a simple "vers=4.1" option and running "mount -a", the contents of the directories are back.
 
Old 02-25-2021, 12:04 PM   #6
computersavvy
Member
 
Registered: Aug 2016
Posts: 947

Rep: Reputation: 363Reputation: 363Reputation: 363Reputation: 363
I think noauto conflicts with x-systemd.automount in that. Don't know about the rest.

vers=4.1,_netdev,noauto,x-systemd.automount,x-systemd.mount-timeout=10,x-systemd.idle-timeout=1min
 
Old 02-25-2021, 01:10 PM   #7
ferrari
LQ Guru
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 5,138

Rep: Reputation: 980Reputation: 980Reputation: 980Reputation: 980Reputation: 980Reputation: 980Reputation: 980Reputation: 980
Quote:
Originally Posted by computersavvy View Post
I think noauto conflicts with x-systemd.automount in that.
Not true.

Quote:
Don't know about the rest.
They are systemd options defined in the links I gave already.
Code:
man systemd.mount
 
Old 02-25-2021, 01:17 PM   #8
ferrari
LQ Guru
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 5,138

Rep: Reputation: 980Reputation: 980Reputation: 980Reputation: 980Reputation: 980Reputation: 980Reputation: 980Reputation: 980
Quote:
Originally Posted by kevindd992002 View Post
This is exactly what I need! So what I did was this:

1. Changed my nfs mount options to:

vers=4.1,_netdev,noauto,x-systemd.automount,x-systemd.mount-timeout=10,x-systemd.idle-timeout=1min

2. Ran "systemctl daemon-reload"
3. Ran "systemctl restart remote-fs.target"
4. Ran "mount -a"
5. I even rebooted my server but when I ls the shares now, it says "cannot open directory '{mount path}': no such device"

What am I missing here?
Can you show the entire fstab entry including mount point?
 
Old 02-25-2021, 01:23 PM   #9
ferrari
LQ Guru
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 5,138

Rep: Reputation: 980Reputation: 980Reputation: 980Reputation: 980Reputation: 980Reputation: 980Reputation: 980Reputation: 980
Quote:
Originally Posted by kevindd992002 View Post
4. Ran "mount -a"
When using 'x-systemd.automount', the NFS share will not be mounted, until a directory or file is accessed explicitly.

Code:
ls -l /path/to share/foo.file
 
Old 02-25-2021, 02:04 PM   #10
uteck
Member
 
Registered: Oct 2003
Location: Elgin,IL,USA
Distribution: GalliumOS on Chrombook
Posts: 619

Rep: Reputation: 201Reputation: 201Reputation: 201
Quote:
Originally Posted by ferrari View Post
When using 'x-systemd.automount', the NFS share will not be mounted, until a directory or file is accessed explicitly.

Code:
ls -l /path/to share/foo.file
So, works just like autofs. :-)
 
Old 02-25-2021, 02:11 PM   #11
ferrari
LQ Guru
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 5,138

Rep: Reputation: 980Reputation: 980Reputation: 980Reputation: 980Reputation: 980Reputation: 980Reputation: 980Reputation: 980
Essentially.

https://learn.redhat.com/t5/Platform...temd/td-p/5631
https://unix.stackexchange.com/quest...ount-vs-autofs
 
Old 02-25-2021, 08:39 PM   #12
kevindd992002
Member
 
Registered: May 2019
Posts: 30

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by ferrari View Post
Can you show the entire fstab entry including mount point?
Code:
# /mnt/video_maine is on synology.home.arpa:/volume1/charmaine/video
synology.home.arpa:/volume1/charmaine/video /mnt/video_maine nfs vers=4.1,_netdev,noauto,x-systemd.automount,x-systemd.mount-timeout=10,x-systemd.idle-timeout=1min 0 0 

# /mnt/video_alvin is on synology.home.arpa:/volume1/alvin/video
synology.home.arpa:/volume1/alvin/video /mnt/video_alvin nfs vers=4.1,_netdev,noauto,x-systemd.automount,x-systemd.mount-timeout=10,x-systemd.idle-timeout=1min 0 0
Quote:
Originally Posted by ferrari View Post
When using 'x-systemd.automount', the NFS share will not be mounted, until a directory or file is accessed explicitly.

Code:
ls -l /path/to share/foo.file
Yes, I realized that after posting here, sorry The -a switch will mount filesystems that are set for auto mounting.

Quote:
Originally Posted by uteck View Post
So, works just like autofs. :-)
Pretty much, as I understand it, but it's a more "native" way of doing things instead of installing autofs.

Last edited by kevindd992002; 02-26-2021 at 04:13 AM.
 
Old 02-25-2021, 08:53 PM   #13
kevindd992002
Member
 
Registered: May 2019
Posts: 30

Original Poster
Rep: Reputation: Disabled
Interestingly enough, I see the automount units in /run/systemd/generator
 
Old 02-26-2021, 03:31 AM   #14
ferrari
LQ Guru
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 5,138

Rep: Reputation: 980Reputation: 980Reputation: 980Reputation: 980Reputation: 980Reputation: 980Reputation: 980Reputation: 980
Quote:
Originally Posted by kevindd992002 View Post
Code:
# /mnt/video_maine is on synology.home.arpa:/volume1/charmaine/video
synology.home.arpa:/volume1/charmaine/video/mnt/video_maine nfs vers=4.1,_netdev,noauto,x-systemd.automount,x-systemd.mount-timeout=10,x-systemd.idle-timeout=1min 0 0
I'm not sure if you just mis-formatted when posting, or you fstab entry is actually missing a space between the export and local mount-point. I woulld expect something more like this...
Code:
synology.home.arpa:/volume1/charmaine/video /mnt/video_maine nfs vers=4.1,_netdev,noauto,x-systemd.automount,x-systemd.mount-timeout=10,x-systemd.idle-timeout=1min 0 0
The same with the second entry.
 
Old 02-26-2021, 04:13 AM   #15
kevindd992002
Member
 
Registered: May 2019
Posts: 30

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by ferrari View Post
I'm not sure if you just mis-formatted when posting, or you fstab entry is actually missing a space between the export and local mount-point. I woulld expect something more like this...
Code:
synology.home.arpa:/volume1/charmaine/video /mnt/video_maine nfs vers=4.1,_netdev,noauto,x-systemd.automount,x-systemd.mount-timeout=10,x-systemd.idle-timeout=1min 0 0
The same with the second entry.
Yes, sorry that was just a typo when I pasted here. I do have a space for both entries so that's not the issue.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
mount.nfs: access denied by server while mounting (null) when mounting nfs shares into each other. weylyn1 Linux - General 5 12-06-2017 01:24 PM
[SOLVED] NFS is not mounting automatically @boot time sjremya Linux - Kernel 6 09-01-2010 02:20 AM
NFS partition not mounting automatically milomak Linux - Networking 2 08-28-2010 04:31 PM
automatically nfs mounting after network monitor connceted? williamdavehall Linux - Laptop and Netbook 2 01-09-2007 12:43 PM
nfs share is not mounting automatically pawlub Linux - General 1 01-03-2004 07:21 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:47 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration