Hi All,
I've been using the same configuration for CentOS 5 and 6 where I have to NFS shares that mount on startup in /etc/fstab. I've placed this same configuration in CentOS 7.2 and the first of the two mounts does not mount properly. If I change the first entry to the IP address it mounts without any issues.
server.company.com:/nfs01/nfshome /nfshome nfs defaults,intr 0 0
server.company.com:/nfs01/shared /mnt/hlmon01/shared nfs defaults,intr 0 0
Here is what I see in the logs:
Mar 2 15:53:43 rc.local: mount.nfs: Failed to resolve server server.company.com: Temporary failure in name resolution
Mar 2 15:53:43 mount: mount.nfs: Failed to resolve server server.company.com: Temporary failure in name resolution
Mar 2 15:53:43 systemd: mnt-server-shared.mount mount process exited, code=exited status=32
Mar 2 15:53:43 systemd: Failed to mount /mnt/hlmon01/shared.
Mar 2 15:53:43 systemd: Unit mnt-server-shared.mount entered failed state.
I've disabled NetworkManager as some older posts suggested that was the cause of the issue but it still hasn't helped. Any suggestions would be appreciated.
Nick
NFS mount in fstab won't mount on startup
Re: NFS mount in fstab won't mount on startup
Personally I'd not use fstab for this. I'd use either autofs or I'd use a systemd mount unit file. For the latter you create a file in /etc/systemd/system/ called something.mount that looks something like this:
Since I stole this config file from my openelec/xbmc box, I am not sure if the naming convention for the file that they talk about in the comments above are xbmc requirements or whether they are systemd itself. You'll need to amend the Before= line to name a service that depends on this mount (or remove it altogether).
Code: Select all
[Unit]
Description=nfs mount script
Requires=network-online.service
After=network-online.service
Before=anything-dependent-on-this-mount.service
[Mount]
What=server.company.com:/nfs01/nfshome
# Where we want mount this share
Where=/nfshome
Options=
Type=nfs
[Install]
WantedBy=multi-user.target
# Important:
# this file must be renamed to <mountpoint>.mount where <mountpoint>, is the FULL path
# where the share will be mounted but slashes "/" MUST BE REPLACED with dashes "-" with .mount
# as extension.
# This means, if we want mount to "/storage/movies2" (see above "Where=/storage/movies2")
# then this file must be renamed to 'storage-movies2.mount' and can be enabled via ssh with the
# command 'servicectl enable storage-movies2.mount'
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke
Re: NFS mount in fstab won't mount on startup
A DNS issue perhaps? Or as Trevor suggests the network may not yet be online?
For DNS, try putting a static entry in /etc/hosts and see if that resolves the issue.
For DNS, try putting a static entry in /etc/hosts and see if that resolves the issue.
Re: NFS mount in fstab won't mount on startup
HI aks,
I don't think the DNS is up at the time for the first NFS mount. The two entries I have are both mounts from the same server. As one mounts the other doesn't. I am going to try systemd to see if that helps.
Nick
I don't think the DNS is up at the time for the first NFS mount. The two entries I have are both mounts from the same server. As one mounts the other doesn't. I am going to try systemd to see if that helps.
Nick
Re: NFS mount in fstab won't mount on startup
Hi All,
I tried to create the systemd file but it isn't working
[Unit]
Description=NFSHOME mount for hlmon01 Directory
Requires=network.target
[Unit]
Description=NFSHOME mount
Requires=network.target
[Mount]
What=server.company.com:/nfs01/nfshome
Where=/nfshome
Type=nfs
Options=
# Make 'systemctl enable tmp.mount' work:
[Install]
WantedBy=multi-user.target
I also tried the network-online.service but that also didn't work.
Any help would be appreciated. It seems to be an issue more with how quickly DNS starts working as using the IP address mounts without any issues.
Nick
~
I tried to create the systemd file but it isn't working
[Unit]
Description=NFSHOME mount for hlmon01 Directory
Requires=network.target
[Unit]
Description=NFSHOME mount
Requires=network.target
[Mount]
What=server.company.com:/nfs01/nfshome
Where=/nfshome
Type=nfs
Options=
# Make 'systemctl enable tmp.mount' work:
[Install]
WantedBy=multi-user.target
I also tried the network-online.service but that also didn't work.
Any help would be appreciated. It seems to be an issue more with how quickly DNS starts working as using the IP address mounts without any issues.
Nick
~
Re: NFS mount in fstab won't mount on startup
So you created that file and then did systemctl enable nfs-home.mount and systemctl start nfs-home.mount (or whatever you called the file)?
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke
Re: NFS mount in fstab won't mount on startup
Yep that is correct. Here are the sym links in /etc/systemd/system/multi-user.target.wants
lrwxrwxrwx 1 root root 44 Mar 8 08:36 mnt-hlmon01-shared.mount -> /etc/systemd/system/mnt-hlmon01-shared.mount
lrwxrwxrwx 1 root root 33 Mar 8 08:36 nfshome.mount -> /etc/systemd/system/nfshome.mount
lrwxrwxrwx 1 root root 44 Mar 8 08:36 mnt-hlmon01-shared.mount -> /etc/systemd/system/mnt-hlmon01-shared.mount
lrwxrwxrwx 1 root root 33 Mar 8 08:36 nfshome.mount -> /etc/systemd/system/nfshome.mount