Network File System (NFS) allows you to share directories between systems over a local network. This guide covers setting up an NFS server on Debian 13, mounting it across macOS, Linux, and Windows, and optimizing read/write speeds.
Part 1: NFS Server Setup (Debian 13)
- Install NFS Kernel Server Update package lists and install the NFS server package:
sudo apt update
sudo apt install nfs-kernel-server
- Configure Directory Permissions Assume your target share directory is /mnt/hd1/sage_nfs. Adjust permissions so client requests map cleanly without permission issues:
sudo chown -R 1000:1000 /mnt/hd1/sage_nfs
sudo chmod -R 775 /mnt/hd1/sage_nfs
- Edit NFS Exports File Open the exports configuration file:
sudo nano /etc/exports
Add the following export rule (replace 192.168.8.0/24 with your local network subnet):
/mnt/hd1/sage_nfs 192.168.8.0/24(rw,sync,no_subtree_check,all_squash,anonuid=1000,anongid=1000,insecure)
insecure: Required for macOS clients, allowing them to connect using non-privileged ports.
all_squash + anonuid/anongid: Maps all client requests to UID/GID 1000 to prevent permission conflicts.
- Apply Changes and Start Service Export the shared directories and start the server:
sudo exportfs -arv
sudo systemctl restart nfs-kernel-server
sudo systemctl enable nfs-kernel-server
Part 2: Client Mounting Guide
- macOS Client macOS handles NFS natively via Finder or terminal.
- Create local mount point:
sudo mkdir -p /Volumes/Sage_nfs
- Mount via Terminal (Optimized):
sudo mount -t nfs -o vers=3,tcp,rsize=1048576,wsize=1048576,noresvport 192.168.8.108:/mnt/hd1/sage_nfs /Volumes/Sage_nfs
- GUI connection: Press Command + K in Finder and enter nfs://192.168.8.108/mnt/hd1/sage_nfs.
- Linux Client (Ubuntu/Debian)
- Install NFS client packages:
sudo apt install nfs-common
- Create mount point and mount:
sudo mkdir -p /mnt/sage_nfs
sudo mount -t nfs -o vers=3,tcp,rsize=1048576,wsize=1048576 192.168.8.108:/mnt/hd1/sage_nfs /mnt/sage_nfs
-
Windows Client (Windows 11/10 Pro)
Windows requires the "Services for NFS" feature enabled.- Open Turn Windows features on or off, check Services for Client for NFS, and click OK. Restart if prompted.
- Open PowerShell or Command Prompt and mount the share to a drive letter:
mount -o nolock,sec=sys 192.168.8.108:/mnt/hd1/sage_nfs Z:
Part 3: Performance Tuning & Optimization
To maximize network throughput and file transfer speeds over a Gigabit local network, apply the following tweaks.
- Increase Buffer Sizes (rsize & wsize) Default NFS block sizes are often small (32KB or 64KB). Bumping them up to 1MB (1048576) significantly reduces network packet overhead during large file transfers:
- Add rsize=1048576,wsize=1048576 to your client mount command options.
Force TCP Protocol
Ensure TCP is explicitly specified (tcp) rather than UDP. TCP provides better throughput and stability for large data streams.Filesystem Mount Options on Debian (/etc/fstab)
If /mnt/hd1 is a dedicated data partition on your Debian server, optimize its internal mount options by adding noatime:
/dev/sdX1 /mnt/hd1 ext4 defaults,noatime,nodiratime 0 2
- noatime: Prevents the OS from writing access timestamps every time a file is read, reducing unnecessary disk I/O.
Top comments (0)