How to Remount an NFS Volume on Red Hat Linux After UID Changes


11 views

When you modify a user's UID on an NFS client system, the changes don't automatically reflect on already-mounted NFS shares. This occurs because NFS maintains its own cache of UID-to-username mappings. The files continue to display the old UID ownership until you force a refresh of the mount.

The most straightforward method is to remount the NFS share. Here's the command sequence:

# Unmount first (if needed)
sudo umount /mnt/nfs_share

# Then remount
sudo mount -t nfs server:/share /mnt/nfs_share -o remount

If you can't unmount the share, try forcing NFS to revalidate its cache:

# For NFSv3
sudo /usr/sbin/rpc.nfsd -f /var/lib/nfs/rmtab

# For NFSv4
sudo systemctl restart nfs-client.target

To prevent future issues, configure idmapd to properly handle UID mappings:

# Edit the idmapd configuration
sudo vi /etc/idmapd.conf

[Translation]
Method = nsswitch

[Mapping]
Nobody-User = nobody
Nobody-Group = nobody

Then restart the service:

sudo systemctl restart rpcidmapd
sudo systemctl restart nfs-idmap

After implementing any of these solutions, verify the changes with:

ls -l /mnt/nfs_share
id username
  • Check /var/log/messages for NFS-related errors
  • Ensure UID/GID consistency across all systems
  • Verify NFS server exports allow the new UID access
  • Consider using NFSv4 with Kerberos for better ID mapping

When you modify user/group IDs (UID/GID) on an NFS client system, you'll often find the existing NFS mount continues displaying old ownership information. This occurs because NFS caches ID mappings for performance reasons. The cache doesn't automatically invalidate when local system UIDs change.

Here are three effective ways to refresh NFS mounts on Red Hat Enterprise Linux:


# Method 1: Full remount (most thorough)
sudo umount /mnt/nfs_share
sudo mount -t nfs server:/export /mnt/nfs_share

# Method 2: Lazy remount (won't disrupt active operations)
sudo mount -o remount,lazy /mnt/nfs_share

# Method 3: Exportfs refresh (when server-side changes occurred)
sudo exportfs -ra

NFS identifies files by numeric UIDs/GIDs, not usernames. The mapping happens via:

  1. /etc/passwd and /etc/group on the client
  2. idmapd service for NFSv4
  3. Kernel's idmapper cache

When you run chown locally, it only updates the client's mapping - the NFS server still references the original numeric IDs.

For permanent solutions in /etc/fstab, add these options:


server:/export  /mnt/nfs_share  nfs  rw,noatime,hard,intr,noauto,x-systemd.automount  0  0

The x-systemd.automount option helps with automatic remounting when UIDs change.

After remounting, verify with:


ls -ln /mnt/nfs_share  # Shows numeric IDs
id username           # Verify new UID matches
nfsstat -m            # Check mount status
  • Restart rpcidmapd: sudo systemctl restart rpcidmapd
  • Clear kernel cache: echo 3 > /proc/sys/vm/drop_caches
  • Check server exports: showmount -e nfs_server