Hello,
I have created about 140 directories in a base directory. I have exported the directory over NFS. Behaviour is the same regardless where I mount it (tried on OSX, remote linux, localhost, FreeBSD).
I'm seeing around 1/3 of the directories (which all have a unique owner and a common group) show owned as root and group root, while the others have proper ownerships but all group root over NFS.
[root@homedirs foo]# ls -ltr | grep -v "root root" |wc -l
38
[root@homedirs foo]# ls -ltr | grep "root root" |wc -l
101
All the directories were created at the same time using a for loop, all UID/GID mapping is working as expected on remote linux hosts as well as the localhost exporting. When mounted via NFS, many directories UID/GID is squashed to root.
Because it is happening when I NFS mount the directory onto the localhost itself, and it is behaving the same as if remote, I'm leaning on it being some bug/limitation while exporting.. I've tried mounting with v4.0 an 4.2 - same behaviour. That said - I'm experimenting with using LVM - its part of the problem most likely. If I rsync that directory to another directory (just to create the folders and permissions), when I export that and mount it, everything works as expected. I'm not stuck on using LVM in the way I was playing with, just curious why its like this..
Any ideas what to check would be appreciated, thanks!
-greg
Here is what it looks like on the local filesystem:
drwxr-x--- 2 atilla domainuser 6 Aug 11 17:44 atilla
drwxr-x--- 2 dave domainuser 6 Aug 11 17:44 dave
drwxr-x--- 2 emilio domainuser 6 Aug 11 17:45 emilio
drwxr-x--- 2 jordan domainuser 6 Aug 11 17:44 jordan
drwxr-x--- 2 mark domainuser 6 Aug 11 17:44 mark
drwxr-x--- 2 mat domainuser 6 Aug 11 17:44 mat
drwxr-x--- 2 matthew domainuser 6 Aug 11 17:40 matthew
drwxr-x--- 2 mihir domainuser 6 Aug 11 17:44 mihir
drwxr-x--- 2 tharanipathi domainuser 6 Aug 11 17:44 tharanipathi
drwxr-x--- 2 tie domainuser 6 Aug 11 17:44 tie
and when you NFS v3 mount it:
drwxr-x--- 2 emilio root 6 Aug 11 17:20 emilio
drwxr-x--- 2 jordan root 6 Aug 11 17:20 jordan
drwxr-x--- 2 mark root 6 Aug 11 17:20 mark
drwxr-x--- 2 tharanipathi root 6 Aug 11 17:20 tharanipathi
drwxr-x--- 2 tie root 6 Aug 11 17:20 tie
drwxr-xr-x 2 root root 6 Aug 11 17:20 atilla
drwxr-xr-x 2 root root 6 Aug 11 17:20 dave
drwxr-xr-x 2 root root 6 Aug 11 17:20 mat
drwxr-xr-x 2 root root 6 Aug 11 17:20 mihir
[root@homedirs people]# cat /etc/exports
/usr/people 10.0.0.0/8(rw,sync,no_subtree_check)
nfsd section from nfs.conf
[nfsd]
debug=0
threads=64
grace-time=90
lease-time=90
tcp=y
vers3=y
vers4=n
vers4.0=n
vers4.1=n
vers4.2=n
rdma=y
/etc/sysctl.conf
fs.nfs.nfs4_disable_idmapping = 0
fs.nfs.nlm_tcpport = 53248
fs.nfs.nlm_udpport = 53248
fs.nfs.nlm_timeout = 10
sample of what the devices look like:
[root@homedirs foo]# ls -ltr /dev/dm-*
brw-rw---- 1 root disk 253, 0 Aug 14 18:04 /dev/dm-0
brw-rw---- 1 root disk 253, 1 Aug 14 18:04 /dev/dm-1
brw-rw---- 1 root disk 253, 2 Aug 14 18:04 /dev/dm-2
brw-rw---- 1 root disk 253, 3 Aug 14 18:04 /dev/dm-3
[root@homedirs foo]# mount | grep mat\
/dev/mapper/peopledirs-mat on /usr/people/mat type xfs (rw,relatime,attr2,inode64,logbufs=8,logbsize=32k,noquota)
[root@homedirs foo]# exportfs -s
/usr/people 10.0.0.0/8(sync,wdelay,hide,no_subtree_check,sec=sys,rw,secure,root_squash,no_all_squash)
[root@homedirs foo]# uname -ar
Linux homedirs.XX.XX.com 5.14.0-284.25.1.el9_2.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Aug 2 14:53:30 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
[root@homedirs foo]# dnf list installed *nfs*
Installed Packages
libnfsidmap.x86_64 1:2.5.4-18.el9 @baseos
nfs-utils.x86_64 1:2.5.4-18.el9 @baseos
nfs-utils-coreos.x86_64 1:2.5.4-18.el9 @appstream
sssd-nfs-idmap.x86_64 2.8.2-3.el9_2 @baseos
[root@homedirs foo]# grep mat\ /etc/fstab
/dev/peopledirs/mat /usr/people/mat xfs defaults 0 2
AD is used for Auth and uid/gid lookups.