Software & AppsOperating SystemLinux

How To Fix “mount.nfs: Failed to resolve server /: Name or service not known” Error in Ubuntu

Ubuntu 9

In this article, we’ll delve into the “mount.nfs: Failed to resolve server /: Name or service not known” error in Ubuntu and provide a comprehensive guide on how to fix it. This error usually arises when you’re trying to mount a Network File System (NFS) share.

Understanding the Error

Before we dive into the solution, it’s important to understand what this error means. The “mount.nfs: Failed to resolve server /: Name or service not known” error typically indicates that the NFS client (your Ubuntu machine) is unable to resolve the NFS server’s hostname or IP address. This could be due to a variety of reasons such as incorrect server address, network connectivity issues, or server-side configuration errors.

Step 1: Correct the Server Address

The first step in resolving this error is to ensure that you’ve entered the correct server address. The error often occurs when there are double forward slashes (//) in the server address in /etc/fstab. The correct format for NFS server address is 10.95.176.67:/DataStore.

To edit the /etc/fstab file, use the command:

sudo nano /etc/fstab

Replace //10.95.176.67 with 10.95.176.67:/DataStore and save the changes.

Step 2: Check NFS Server Status

Next, check if the NFS server is running on the remote server (10.95.176.67). You can do this by running the command showmount -e 10.95.176.67.

The showmount command queries the mount daemon on a remote host for information about the NFS server’s state of the file systems being shared with clients. The -e option stands for ‘exports’, which lists the shared directories and their access control lists.

If the NFS server is not running, you may need to start the NFS server daemon on the server.

Step 3: Verify Open Ports

Ensure that the necessary ports for NFS and portmapper are open on the server. NFS typically uses TCP 2049, UDP 2049, and UDP 111. If the ports are blocked, you won’t be able to mount the shared directory. You can check if these ports are open using the nmap command:

nmap -p 111,2049 10.95.176.67

If the ports are not open, refer to your server’s documentation or network administrator for assistance in opening the required ports.

Step 4: Check Shared Directory

Verify that the shared directory (/DataStore) is correctly exported on the server. This is typically configured in the /etc/exports file on the server. The exports file defines the directories that will be shared to other systems via NFS.

To view the contents of the exports file, use the command:

cat /etc/exports

Ensure that the server allows access to the NFS share from your client machine.

Step 5: Check Network Connectivity

If you’re still experiencing issues, check the network connectivity between your client and the server. Use the ping command to check if the server is reachable:

ping 10.95.176.67

If the server is not reachable, there might be network/firewall issues blocking the communication.

Conclusion

By following these steps, you should be able to fix the “mount.nfs: Failed to resolve server” error and successfully mount the NFS share. Remember, the key to resolving this issue lies in careful diagnosis and systematic troubleshooting. If you’re still facing issues, consider seeking help from the Ubuntu community or professional system administrators.

What is NFS?

NFS stands for Network File System. It is a distributed file system protocol that allows a user on a client computer to access files over a network as if they were on their own local hard drive.

How do I edit the `/etc/fstab` file?

To edit the /etc/fstab file, you can use a text editor such as nano or vim. Open a terminal and run the command sudo nano /etc/fstab to open the file in the nano editor with root privileges. Make the necessary changes, save the file, and exit the editor.

How can I check if the NFS server is running?

You can check if the NFS server is running on the remote server by running the command showmount -e [server IP]. Replace [server IP] with the actual IP address of the NFS server. This command will display the shared directories and their access control lists.

How do I check if the necessary ports for NFS are open?

To check if the necessary ports for NFS are open on the server, you can use the nmap command. Run the command nmap -p 111,2049 [server IP] to scan for open ports. Replace [server IP] with the actual IP address of the NFS server. The output will show if the required ports (TCP 2049, UDP 2049, and UDP 111) are open or closed.

How can I view the contents of the `/etc/exports` file?

To view the contents of the /etc/exports file, use the command cat /etc/exports in the terminal. This will display the directories that are configured to be shared via NFS on the server.

How can I check network connectivity between my client and the server?

To check network connectivity between your client and the server, you can use the ping command. Run ping [server IP] in the terminal, replacing [server IP] with the actual IP address of the NFS server. If the server is reachable, you will see responses from the server. If not, there might be network or firewall issues blocking the communication.

Leave a Comment

Your email address will not be published. Required fields are marked *