1

Okay so I'm new to all this stuff. I've never worked on Linux servers before. I have an Ubuntu server and Debian stretch ver 9. I installed nfs server on Ubuntu and nfs client on Debian. The machines are able to ping one another but the problem is that when I try to mount nfs share from Ubuntu to debian, it says

mount.nfs: connection timed out

The command I'm running on Debian is:

# mount <ip of Ubuntu>:/export/nfs /mnt/nfs

I created /mnt/nfs in Debian. Here, /export/nfs is the directory I created on Ubuntu and the ownership is nobody:nogroup. I also edited the /etc/exports and added the following in it:

/export/nfs <internal-network>/24(rw,insecure,all_squash).

I don't know what the problem is. Can someone please tell me what I am doing wrong?

Khaled
  • 36,533
  • 8
  • 72
  • 99
Chirag
  • 11
  • 1
  • 2

3 Answers3

1

Specify the host name of the ubuntu server before the : in your command.

For RedHat, but the idea is the same: https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/3/html/System_Administration_Guide/s1-nfs-mount.html

If the host name is myubuntu and share is /export/nfs then it should be mount myubuntu:/export/nfs not just mount :/export/nfs

Also, make sure you have iptables open and not blocking the ports.

Appleoddity
  • 3,488
  • 2
  • 13
  • 33
  • did not answer the question, if you check OP he employed every detail you mentioned except you use hostname instead of IP. – Jones G May 29 '21 at 05:35
  • @JonesG the question was edited after my answer and this information was added by a user other than the OP. I don’t know why. The original post exactly what I described, which was the hostname/ip was missing. You can look at the edit history for details. – Appleoddity May 29 '21 at 14:09
0

escalate privilege if need be using sudo prefix

$ mount -t nfs -o _netdev,rw,proto=tcp,sec=sys [serverip]:[location] [local mount point]

do not forget the underscore preceding netdev

_netdev is correct - will prevent from system from hanging if server is not online

example

$ mount -t nfs -o rw,_netdev,proto=tcp,sec=sys 10.10.2.1:/mnt/ZFS/PROXMOX/ /media/PROXMOX

Running mount -v (verbose) may give a clue

Paul
  • 3,037
  • 6
  • 27
  • 40
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Nov 30 '21 at 18:28
0

If the direcotry /mnt/nfs on the client machine doesn't exist already, create it first:

mkdir /mnt/nfs

It seems to be that you want to mount the share for longer time and not only temporary? If so, anothere location instead of /mnt would be preferable, because /mnt ist meant for temporary mounts - if not it's ok like that.

If you want to mount it fix, just add this lines to your /etc/fstab file:

Open the file with nano for example: nano /etc/fstab

<ip of Ubuntu>:/export/nfs/    /mnt/nfs    nfs    rw,sync,hard,intr    0    0

and enter the following command, to mount all entries from /etc/fstab

mount

Using ip or dns-name doesn't matter.

On the Server side, you have to reload the /etc/exports file whenever you edit it with the command exportfs -a

Also try to restart your nfs-server:

sudo /etc/init.d/nfs-kernel-server restart 

If the systems aren't in the same subnet, check also if a external firewall is between them. With iptables -L you can check, if for a internal firewall on the systems, as well.