1

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 is 192.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

[2] https://help.ubuntu.com/community/SettingUpNFSHowTo#Mounting_NFS_shares_in_encrypted_home_won.27t_work_on_boot

[3] = [1] + [2]

[4] mimicking the mount options of the local device partitions in etc/fstab

  • Have you dug into boot / error logs? There might be useful messages there. Also what kind of network connectivity do you have? I suspect it does not work because your network is not online when the mount is attempted but that's just an educated guess. – Olivier Dec 20 '16 at 14:33
  • @Olivier Could you please give direction to which files I should look into? Also note that, in both machines, the \home directory is mounted on an own partition, so perhaps mounting \home\exports\* afterwards from \etc\fstable suffers from this nesting... (new info added to the question) – XavierStuvw Dec 20 '16 at 14:45
  • should be something like /var/log/boot.log on ubuntu 14 but I think Sagar has the answer to your problem already. _netdev will let the boot system know to wait until the network is working to do the mount. – Olivier Dec 20 '16 at 14:58
  • @Olivier /var/log/boot.org shows only one suspicious fail at line 1 * Starting Read required files in advance[234G[[31mfail[39;49m], all the other operations featuring mounting and network are [ OK ]. One other fail deals with printers and a NSM status monitor. Sagar's solution to this moment is not effective either. – XavierStuvw Dec 20 '16 at 17:58
  • Try adding bg to your mount options in /etc/fstab. – Olivier Dec 20 '16 at 21:04
3

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"

  • Nope, unfortunately. After your line I still need to launch sudo mount -a to get the mounting done. Also, chkconfig is no package supported by Ubuntu, if I am not wrong (I myself had launched a sudo service nfs-kernel-server start earlier -- but that's on the server's side anyhow, I believe, while I am struggling at the client's side) – XavierStuvw Dec 20 '16 at 17:40
  • Please share your boot logs. _netdev is for network device and mounts the device once network service is up. – Sagar Dec 22 '16 at 2:26
  • Also share output of "tail -1 /etc/mtab " after firing sudo mount -a. – Sagar Dec 22 '16 at 2:33
0
  1. Create a file at: /etc/network/if-up.d/fstab

  2. Add this to it:

    #!/bin/sh
    mount -a
    
  3. 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.

New contributor
LiberiFatali is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.