How to Mount an NFS Share on CasaOS: A Comprehensive Guide

Welcome to our latest blog post, where we delve into the world of NFS (Network File System) and explore how to effectively mount an NFS share on CasaOS. Whether you’re an IT professional, a hobbyist, or someone interested in network storage solutions, this guide aims to provide a clear and concise walkthrough for setting up NFS on your system.

What is NFS?

NFS is a protocol that enables the sharing of directories and files over a network. It’s widely used due to its simplicity and effectiveness in allowing multiple users to access the same data. However, setting it up requires a bit of know-how, especially when working with specific operating systems like CasaOS.

Step-by-Step Guide to Manually Mounting an NFS Share

1. Installing NFS Client Packages

Before mounting an NFS share, you must have the NFS client package installed on your system. The package name differs between Linux distributions. For Ubuntu and Debian, execute sudo apt update and sudo apt install nfs-common.

2. Creating a Mount Point

A mount point is a directory where the NFS share will be mounted. You can create it using the mkdir command. For example, sudo mkdir /var/backups.

3. Mounting the NFS Share

Use the mount command to mount the NFS share. The general format is sudo mount -t nfs NFS_SERVER:EXPORTED_DIRECTORY MOUNT_POINT. Ensure to replace placeholders with actual IP addresses and directory paths​​.

Automatic Mounting Using /etc/fstab

To have your NFS share automatically mounted on system boot, use the /etc/fstab file:

  1. Creating a Mount Point: Similar to the manual method, create a directory to serve as the mount point.
  2. Editing /etc/fstab: Add a line to this file in the format NFS_SERVER:EXPORTED_DIRECTORY MOUNT_POINT nfs defaults 0 0.
  3. Testing the Configuration: Run mount -a to mount all file systems listed in /etc/fstab and use df -h to confirm if the NFS share is mounted​​.

Unmounting NFS File Systems

To unmount an NFS share, use the umount command. If the share is busy, you can use the fuser command to find and stop the processes using it​​​​.

Conclusion

Mounting an NFS share on CasaOS can greatly enhance your network storage capabilities. Whether manually or automatically, the process is straightforward if you follow the steps outlined. Always ensure that your shares are secure and your system is optimized for the best performance.

Remember, this guide is a general overview. Specifications may vary based on your system and network setup, so adjust the steps accordingly. And as always, back up your important files before making significant changes to your system’s configuration.

Feel free to share your experiences or ask questions in the comments below. Happy networking!

Does this make these mounts persistent?

Yes when you add it to fstab:

What if I want my Casa OS device (Zimaboard NAS) to be the server and a Raspberry Pi to be the “client”? I have a Jellyfin instance on my Zimaboard NAS and want to be able to mount those movie, tv show and music files on my Pi5.

Great question! Setting up your CasaOS device (Zimaboard NAS) as the NFS server and your Raspberry Pi as the client is definitely possible. This setup will allow you to access your Jellyfin media files (movies, TV shows, and music) on your Pi5.

Here’s a step-by-step guide to achieve this:

  1. Set up NFS Server on CasaOS (Zimaboard NAS):

    a. First, ensure that the NFS server package is installed on your CasaOS device. You may need to use the CasaOS interface or SSH into your Zimaboard to install it.

    b. Edit the /etc/exports file to define which directories you want to share. Add a line like this:

    /path/to/jellyfin/media *(rw,sync,no_subtree_check)
    

    Replace “/path/to/jellyfin/media” with the actual path to your media files.

    c. After editing, restart the NFS server:

    sudo systemctl restart nfs-kernel-server
    
  2. Set up NFS Client on Raspberry Pi:

    a. Install the NFS client on your Raspberry Pi:

    sudo apt update
    sudo apt install nfs-common
    

    b. Create a mount point on your Pi:

    sudo mkdir /mnt/jellyfin-media
    

    c. Mount the NFS share:

    sudo mount -t nfs ZIMABOARD_IP:/path/to/jellyfin/media /mnt/jellyfin-media
    

    Replace ZIMABOARD_IP with the actual IP address of your Zimaboard NAS.

  3. Make the mount permanent (optional):

    To automatically mount the share on boot, add this line to /etc/fstab on your Raspberry Pi:

    ZIMABOARD_IP:/path/to/jellyfin/media /mnt/jellyfin-media nfs defaults 0 0
    
  4. Test the mount:

    On your Raspberry Pi, navigate to the mount point and check if you can see your media files:

    cd /mnt/jellyfin-media
    ls
    

Remember to ensure that both devices are on the same network and that any firewalls are configured to allow NFS traffic (usually on port 2049). Also, make sure to secure your network appropriately, as NFS doesn’t provide encryption by default.

Thank you so much for the quick response! I’ll be trying this out next weekend! Does the NFS server open port 2049 to anything that pings it (Even outside my internal LAN)? I’m new to all this, I put together my own network equipment and certainly don’t want to jeopardize my security! I can also access my Jellyfin instance via a cloudflare tunnel and I have security set up on that.

THANK YOU!