First of all thank you for your time. I've been fighting for two days with this problem. I have the same environment in ubuntu 14.04 and is working perfect. So, let's start:
I want to mount a NFS at boot time. This NFS will have /etc/apache2 and other config folders. So, my fstab (working in 14.04) look like this:
X.X.X.X:/share_NFS /mnt/nas nfs auto,nolock,soft,intr,nfsvers=3,tcp,bg,rw 0 0
Then, I bind every folder that I want to mount in the NFS like this:
/mnt/nas/config/apache2 /etc/apache2 none auto,rbind,defaults 0 0 /mnt/nas/config/php5 /etc/php5 none auto,rbind,defaults 0 0 /mnt/nas/config/logrotate.d /etc/logrotate.d none auto,rbind,defaults 0 0 /mnt/nas/config/postfix /etc/postfix none auto,rbind,defaults 0 0 /mnt/nas/www /var/www none auto,rbind,defaults 0 0
My problem: The problem is when I boot the machine. Sometimes it's mounted correctly and sometimes not. If I reboot the machine, I have 25% of probability that NFS is not mounted correctly. If I make a "mount -a" it mounts fine.
I'm almost certain that there is a systemd problem. I found a lot of problems and some bugs with NFS and remote-fs.target dependencies in systemd. But anyone has a clear a solution. For example, I changed some dependencies of remote-fs.target just to require network-online, but it didn't work for me.
i think that is a matter of how systemd start the remote-fs.target and NFS.
I noticed that for every mountpoint of /etc/fstab, systemd generates a unit ended with .mount. So, if I look for this units:
systemctl show mnt-nas.mount
I saw this:
Names=mnt-nas.mount Requires=system.slice -.mount Wants=network-online.target RequiredBy=etc-logrotate.d.mount etc-php5.mount remote-fs.target var-www.mount etc-apache2.mount etc-postfix.mount Conflicts=umount.target Before=etc-logrotate.d.mount umount.target etc-php5.mount remote-fs.target var-www.mount etc-apache2.mount etc-postfix.mount After=systemd-journald.socket remote-fs-pre.target system.slice network.target -.mount network-online.target RequiresMountsFor=/mnt
My questions: Has anyone had this problem? has anyone get this kind of behaviour mounting NFS at boot time? How you solved if you had?
Thank you very much!