Introduction
I use NFS shares on my own homelab and I need it to access files like movies and tv shows on my NAS. So therefor I just need a fast and unencrypted file share in my network nothing else.
Installation
Preparation
In order to prevent permission issues between your NAS (or NFS file server) and your client I’ll strongly recommend to reassign the UID and GID of your current clients user according to the UID/GID on the server.
Scenario
- Old identity:
username → UID:GID 1000:1000 - New identity:
username → UID:GID 1027:100
First is the common case on Linux filesystems. The second entry shows the UID/GID example of a Synology NAS.
Log off from GUI
First of all log off from your desktop session completly and switch to another terminal by pressing Ctrl+F3. After that logon as root.
In order to prevent any issues it would be best practice to use any Live-Image and chroot into your installation. For example if you use CachyOS you can use cachy-chroot in the terminal. It will do all needed steps automatically for you.
Switch UID / GID
After that switch the ids. Replace <user> with the username you want to switch the ids.
1
2
| usermod -u 1027 <user>
usermod -g 100 <user>
|
Reassign Ownership by UID
Change ownership of all files that still belong to the old UID:
1
| find / -user 1000 -exec chown -h 1027 {} \;
|
Change ownership of all files that still belong to the old GID:
1
| find / -group 1000 -exec chgrp -h 100 {} \;
|
| Parameter | Explanation |
|---|
| / | Start at the filesystem root. |
| -xdev | Do not cross filesystem boundaries (prevents touching /proc, /sys, NFS mounts, etc.). |
| -(g,u)id 1000 | Match only files owned by the old UID. |
| -exec chown -h 1027 {} \; | Change the owner to the new UID. |
| -h | Ensures symbolic links are updated without dereferencing. |
Final Step
This step is highly recommended.
After reboot logon with your normal user account and verify that all is working correctly. Also check the new ids with id command.
Verification
1
2
3
4
| id $USER
getent passwd $USER
getent group | grep 100
ls -ln /home/$USER | head
|
Mounting
Server » Client
1
2
| # NFS-Share
192.168.0.5:/volume1/backups /mnt/nas/backups nfs4 users,_netdev,noatime,nofail,x-systemd.automount,x-systemd.idle-timeout=600,x-gvfs-show,hard,nfsvers=4.1,proto=tcp,lock,noatime,lookupcache=positive 0 0
|
| Option | Category | Description | Notes / Impact |
|---|
_netdev | Boot / Networking | Tells the system that this filesystem requires network access. Prevents the system from blocking during boot if the network or NAS is unavailable. | Essential for systems where the NAS is not always online. |
nofail | Boot Handling | Allows the system to continue booting even if the mount fails. | Prevents emergency mode when the NAS is offline. |
x-systemd.automount | systemd | Defers the actual mount operation until the directory is first accessed. | Eliminates boot delays and mount errors when the NAS is offline. |
x-systemd.idle-timeout=600 | systemd | Automatically unmounts the share after 600 seconds (10 minutes) of inactivity. | Allows clean NAS shutdowns and avoids stale mounts. |
x-gvfs-show | Desktop Integration | Makes the mount visible in graphical file managers (GVFS-based, e.g., GNOME Files). | Optional; useful on laptops or desktop systems. |
hard | NFS Semantics | Ensures NFS operations retry indefinitely until the server responds. Guarantees data integrity. | Recommended for writable shares; may block processes during active I/O if the NAS goes offline. |
nfsvers=4.1 | NFS Protocol | Forces use of NFS version 4.1. | Synology DSM 7 defaults to 4.1; explicit setting avoids negotiation issues. |
proto=tcp | Transport | Forces TCP as the transport protocol for NFS traffic. | TCP is reliable and standard for NFSv4. |
lock | File Locking | Enables NFS file locking support. | With NFSv4, locking is integrated; this option is effectively a no-op but harmless. |
noatime | Filesystem Metadata | Disables access time updates on files. | Reduces write I/O and improves performance. |
lookupcache=positive | NFS Client Cache | Caches only positive name lookups (existing files), not negative ones. | Improves consistency when files are created or removed on the server. |
Server » Server
1
2
| # NFS-Share
192.168.178.5:/volume1/backups /mnt/nas/backups nfs4 _netdev,hard,nfsvers=4.1,proto=tcp,lock,noatime,rsize=1048576,wsize=1048576,timeo=600,retrans=5,actimeo=1,nofail 0 0
|
| Option | Category | Short Explanation |
|---|
_netdev | Boot / Networking | Marks the filesystem as network-dependent to prevent boot blocking if the network or server is unavailable. |
hard | NFS Semantics | Forces NFS operations to retry until the server responds, ensuring data integrity. |
nfsvers=4.1 | NFS Protocol | Explicitly selects NFS version 4.1 for compatibility and stability. |
proto=tcp | Transport | Uses TCP for NFS traffic, providing reliable data transmission. |
lock | File Locking | Enables NFS file locking (integrated by default in NFSv4). |
noatime | Filesystem Metadata | Disables access time updates to reduce write overhead. |
rsize=1048576 | Performance | Sets the read buffer size to 1 MiB for higher throughput. |
wsize=1048576 | Performance | Sets the write buffer size to 1 MiB for higher throughput. |
timeo=600 | Timeout | Sets the NFS RPC timeout to 60 seconds (600 tenths of a second). |
retrans=5 | Retry Policy | Limits the number of retransmissions before reporting an error. |
actimeo=1 | Attribute Caching | Caches file attributes for 1 second to balance performance and consistency. |
nofail | Boot Handling | Allows the system to continue booting even if the mount fails. |