π§ NFS Setup Guide β MiniPC β Main PC
This guide describes how to share directories between two Linux systems (e.g., MiniPC as server and Main PC as client) using NFS.
It also includes troubleshooting notes and alternative sharing methods.
βοΈ 1. Install NFS
On the MiniPC (server)
| |
On the Main PC (client)
| |
π 2. Create and prepare shared directory on the MiniPC
| |
(Replace youruser with your actual username β both systems should have the same UID, usually 1000.)
π 3. Configure /etc/exports on the MiniPC
Edit the file:
| |
Add this line:
/srv/nfs/share 192.168.1.0/24(rw,sync,no_subtree_check)
Then apply changes:
| |
π 4. Mount the NFS share on the Main PC
| |
(Replace 192.168.1.50 with the actual IP of your MiniPC.)
You can now access /mnt/minipc-nfs like a local folder.
π 5. Optional β make the mount persistent
Add this line to /etc/fstab on the Main PC:
192.168.1.50:/srv/nfs/share /mnt/minipc-nfs nfs defaults,user,rw,soft,timeo=5,retrans=2 0 0
Then test:
| |
π§ͺ 6. Verify and test permissions
On the Main PC:
| |
If you can create and edit files, your NFS setup works correctly.
π οΈ Troubleshooting
| Problem | Likely Cause | Fix |
|---|---|---|
| “Permission denied” when writing | Ownership mismatch | Ensure both users have the same UID (id -u) and chown -R youruser /srv/nfs/share |
| Can read but not write | Wrong export options | Check /etc/exports β (rw,sync,no_subtree_check) |
| Mounts disappear on reboot | No fstab entry | Add persistent mount in /etc/fstab |
| Laggy writes | Use sync instead of async in exports for safety (slower but safer) | |
| Need root access from client | Add no_root_squash to export options (trusted LAN only) |
π Security Notes
- Restrict access to your local subnet:
192.168.1.0/24 - Avoid exposing NFS ports (2049) to the internet.
- Use SSH tunnels or VPN (e.g., Tailscale, WireGuard) if you must access remotely.
- For multiple users, ensure UID/GID mapping consistency across machines.
βοΈ Alternatives to NFS
| Method | Use Case | Pros | Cons |
|---|---|---|---|
| SSHFS | Ad-hoc secure mounts | Encrypted, easy (works over SSH) | Slightly slower I/O |
| Samba (SMB) | Mixed OS (Windows/Linux) | Compatible with Windows shares | More config, heavier protocol |
| Syncthing | Continuous sync | Encrypted, auto-syncs both ways | Not a live mount, needs both online |
| rsync | One-way backups/syncs | Reliable, scriptable | Manual or cron-based, no real-time changes |
| WebDAV | Remote over HTTPS | Simple, firewall-friendly | Slower, permission quirks |
| VSCode Remote SSH | Editing remote files | Great dev experience | Not general file access |
π§° Quick Commands Recap
| |
β Result
You can now:
- Browse, create, and edit files from your main PC directly on your MiniPC.
- Use the share in scripts, Docker bind mounts, and backup tasks.
Last updated: 2025-11-01