Bobcares

How to Set Up an NFS Mount on Ubuntu 24.04

PDF Header PDF Footer

Discover how to set up an NFS mount on Ubuntu 24.04. Our experienced NFS Support team is ready to assist.

How to Set Up an NFS Mount on Ubuntu 24.04

How to Set Up an NFS Mount on Ubuntu 24.04Sharing files across machines in a network can be made easy with NFS (Network File System). If you’re running Ubuntu 24.04, setting up an NFS mount is an easy way to make files accessible between systems, whether for a collaborative workspace, centralized data storage, or managing multiple servers.

Users sometimes encounter issues like NFS permission denied when accessing shared directories. You can learn how to resolve it in our OpenMediaVault NFS permission denied guide.

Today, we will walk through the step-by-step process of setting up an NFS mount on Ubuntu 24.04, both on the server and the client side.

What is NFS?

NFS (Network File System) is a protocol that enables systems to share directories and files over a network as if they were part of the local file system. It’s commonly used in enterprise environments to streamline access to shared data, reduce redundancy, and improve collaboration across devices on the same LAN.

Prerequisites

Before we begin, we need:

  • One or more systems running Ubuntu 24.04
  • Sudo privileges on both server and client machines
  • The IP address of the server that will host the shared directory

Step-by-Step Guide

  1. We will start by installing the NFS server package on the machine that will host the shared directory:

    sudo apt update
    sudo apt install nfs-kernel-server
  2. Once installed, confirm that the NFS server is active:
    sudo systemctl status nfs-server
  3. Next, create the directory we want to share. For example:
    sudo mkdir -p /srv/nfs/nfs_share
  4. We need to adjust permissions to make the directory accessible:
    sudo chown nobody:nogroup /srv/nfs/nfs_share
    sudo chmod 777 /srv/nfs/nfs_share
  5. Then, open the NFS exports configuration file:
    sudo nano /etc/exports
  6. Now, add the following line, replacing `CLIENT_IP` with the IP address of the client machine:
    /srv/nfs/nfs_share CLIENT_IP(rw,sync,no_subtree_check)

    Here:

    • rw: Enables read/write access
    • sync: Ensures changes are committed to disk before completing operations
    • no_subtree_check: Disables subtree checking for better performance
  7. Then, apply the export settings:
    sudo exportfs -a
  8. Also, ensure the NFS server starts at boot and is currently running:

    sudo systemctl enable nfs-server
    sudo systemctl start nfs-server
  9. If we are using UFW (Uncomplicated Firewall), allow NFS traffic:
    sudo ufw allow from CLIENT_IP to any port nfs
  10. Now, install the necessary NFS utilities on the client machine:

    sudo apt update
    sudo apt install nfs-common

    If you encounter package errors such as “Unable to find a match: nfs-utils-lib”, here’s how to fix the nfs-utils-lib issue.

  11. Then, create a local directory to mount the shared NFS folder:
    sudo mkdir -p /mnt/nfs_share
  12. Now, mount the shared directory using the server’s IP address:
    sudo mount SERVER_IP:/srv/nfs/nfs_share /mnt/nfs_share
  13. To verify the mount:
    df -h

    We will see the NFS share listed among your mounted filesystems. You might occasionally face mount failures like Network Error 53. Check out our guide on resolving NFS Network Error 53 for help.

  14. We can also mount NFS automatically on boot by adding it to the `/etc/fstab` file:
    sudo nano /etc/fstab

    Add the following line:

    SERVER_IP:/srv/nfs/nfs_share /mnt/nfs_share nfs defaults 0 0
  15. Save and exit. The mount will now persist across reboots.

Be aware of issues such as a file ID change on the NFS server, which can interrupt file access. Here’s how to fix the fileid changed error.

[Need assistance with a different issue? Our team is available 24/7.]

Conclusion

Setting up an NFS mount on Ubuntu 24.04 is an easy way to streamline file sharing across systems.

This guide, created by our Support Engineers, provides instructions on configuring NFS mounts on Ubuntu 24.04.

0 Comments

Submit a Comment

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

Get featured on the Bobcares blog and share your expertise with a global tech audience.

WRITE FOR US
server management

Spend time on your business, not on your servers.

TALK TO US

Or click here to learn more.

Speed issues driving customers away?
We’ve got your back!