In this post, I’ll walk you through how I share two important folders on my Debian-based server at internal IP address 10.0.0.3 using NFS, and how I mount these shares on my Mac. I’ll cover every step, from configuring the server’s exports file to setting up my Mac’s fstab entries so you can see exactly how I manage file sharing on my internal network.
Overview
I use Network File System (NFS) to share directories across my internal network, making it easy to access files from multiple devices. My setup involves a Debian server at 10.0.0.3 hosting two shared directories: /srv/data (general stuff) and /srv/photography (raw files, edits, exports, etc.). I’ve configured these shares so that every device on my internal network (10.0.0.0/24) can access them. On my Mac, I mount these shares by updating my /private/etc/fstab
file.
Setting Up My NFS Server on Debian
Configuring /etc/exports
On my Debian server at 10.0.0.3, I define which directories are shared and who can access them in the /etc/exports
file. My configuration looks like this:
/srv/data 10.0.0.0/24(rw,sync,no_subtree_check)
/srv/photography 10.0.0.0/24(rw,sync,no_subtree_check)
Here’s what these options mean for my setup:
- 10.0.0.0/24: This allows every device on my internal network (from 10.0.0.1 to 10.0.0.254) to access the shares.
- rw: I enable both read and write access, so I can update files as needed.
- sync: This option makes sure that changes are written to disk immediately, which helps maintain data integrity.
- no_subtree_check: I disable subtree checking to improve performance, especially useful since the directories are part of a larger filesystem.
After updating /etc/exports
, I reload the exports to make the changes effective:
sudo exportfs -ra
This command ensures that my new configuration is active right away.
Mounting the NFS Shares on My Mac
Configuring /private/etc/fstab
On my macOS system, I need to mount the NFS shares so I can access them locally. I add the following entries to my /private/etc/fstab
file:
10.0.0.3:/srv/data /Users/steve/data nfs resvport,rw,noowners 0 0
10.0.0.3:/srv/photography /Users/steve/photography nfs resvport,rw,noowners 0 0
Breaking these options down:
- 10.0.0.3:/srv/data: This tells my Mac where the NFS share is located on my Debian server at 10.0.0.3.
- /Users/steve/data: This is the local directory on my Mac where I want the share to be accessible.
- nfs: Specifies the filesystem type.
- resvport: I use a reserved (privileged) port when communicating with the server, which is sometimes required by the NFS service.
- rw: I allow both reading and writing.
- noowners: This option disables file ownership checking, useful for avoiding issues with user ID mismatches between the server and my Mac.
- 0 0: These numbers are standard for dump and filesystem check options on network filesystems.
With these settings, my Mac mounts the shares automatically at startup. Alternatively, I can mount them manually using the mount
command whenever needed.
Testing and Troubleshooting
Once everything is set up, I follow a few steps to ensure my configuration works smoothly:
- On My Debian Server (10.0.0.3):
- I run
exportfs -v
to verify that my directories are exported correctly with the right options. - I also use
showmount -e
to list the available NFS shares.
- I run
- On My Mac:
- I check the mount points (
/Users/steve/data
and/Users/steve/photography
) to confirm that the shares are accessible. - If I run into issues, I make sure that my Mac and the Debian server are connected properly on the network and review the system logs for any NFS-related errors.
- I check the mount points (
Conclusion
By configuring the /etc/exports
file on my Debian server at 10.0.0.3 and setting up my Mac’s /private/etc/fstab
, I’ve created an efficient and reliable way to share and access important directories across my internal network. This setup not only simplifies file management but also ensures that I can easily update and maintain my data across all my devices.
Sharing folders via NFS has streamlined my workflow, and I hope that by sharing my personal experience, you can set up a similar solution for your network too. Happy sharing!