fstab does not mount automatically a NFS remote folder
Solution 1
If your mount -a option works then you should add _netdev in fstab.
192.168.1.1:/home/export /home/import/server1 nfs defaults,_netdev 0 0
Also make sure for "chkconfig netfs on"
Solution 2
Create a file at:
/etc/network/if-up.d/fstab
Add this to it:
#!/bin/sh mount -a
Make the file executable:
sudo chmod +x /etc/network/if-up.d/fstab
You are directing the system at boot time to issue a
mount -a
after the network stack is up and operation which if it's like a cifs mount in fstab is the reason your shares are not mounting at boot.
From this answer: nfs shares in /etc/fstab not loaded on boot in 18.04 at Ubuntu forums.
Related videos on Youtube

XavierStuvw
Proficiency, competence and ambitions of an educated layman, interested in much, expert in little Some experience with programming in FORTRAN, C++, Matlab/Octave, Python and R. Using Linux since 2014 and committed to it I like it when a computer does what I want. It's a creative accomplishment where knowing what I want and wanting what I know come together Happy to help and to be corrected
Updated on September 18, 2022Comments
-
XavierStuvw 2 months
I do not manage to get a remote directory automatically mounted during bootstrap. I am using the NFS protocol under Ubuntu 14.04 LTS. The server is
192.168.1.1
and the client is192.168.1.2
The setting in
/etc/exports
at the server side is/home/export 192.168.1.2(ro,no_root_squash,sync)
Although the
\home\user
directory at the client side is, note that all directories mentioned in this post are not encrypted. The server computer is always on, and the two machines can ping each other. Also note that, in both machines, the\home
directory is mounted on an own partition.The command line works well and I can see the remote content at the mount point after
sudo mount 192.168.1.1:/home/export /home/import/server1
.
Like in How to edit /etc/fstab properly for network drive? I want to mount a network drive by editing
/etc/fstab
. However, when I add any one of those lines to/etc/fstab
[1]
192.168.1.1:/home/export /home/import/server1 nfs rsize=8192,wsize=8192,timeo=14 0 0
[2]
192.168.1.1:/home/export /home/import/server1 nfs auto 0 0
[3]
192.168.1.1:/home/export /home/import/server1 nfs auto, rsize=8192,wsize=8192,timeo=14 0 0
[4]
192.168.1.1:/home/export /home/import/server1 nfs defaults 0 0
I need to launch a
sudo mount -a
manually to get the view on the server side. This defies my expectations and those from this U&L post as well.How can I get the auto-mounting capability running on its own feet?
Inspirations/copy-catting disclosed:
[1] https://help.ubuntu.com/14.04/serverguide/network-file-system.html
[3] = [1] + [2]
[4] mimicking the mount options of the local device partitions in
etc/fstab
-
Sagar almost 6 yearsPlease share your boot logs. _netdev is for network device and mounts the device once network service is up.
-
Sagar almost 6 yearsAlso share output of "tail -1 /etc/mtab " after firing sudo mount -a.