0

On Linux with nfsv3 the command

showmmount -d

show the remote client which mount dir on my nfs server. With nfs4 with a directory remotely mounted the showmount command display nothing. How to know which remote client are using nfs server on my local machine?

2 Answers 2

1

as NFSv4 only uses port tcp/2049 you can simply check connected nfs clients on the server using:

ss -tano state established sport nfs

0

Solution found.

netstat -ta | grep nfsd|grep ESTA|awk '{print $5}'|cut -d : -f 1

or

ss -rta | grep nfsd|grep ESTA|awk '{print $5}'|cut -d : -f 1

and show all my clients connected.

To show the directories opened and file used we can query the good old procfs Supposing my client is identified by 215

cd /proc/fs/nfsd/clients/215

I see 3 files

ctl  info  states

on file info I can see the ip, port used, hostname of client

clientid: ******************
address: "192.168.0.2:850"
status: confirmed
name: "Linux NFSv4.2 myclient.host.example"
minor version: 2
Implementation domain: "kernel.org"
Implementation name: "Linux 6.1.12 #1 SMP PREEMPT_DYNAMIC Sat Feb 18 16:45:16 CET 2023 x86_64"
Implementation time: [0, 0]
callback state: UP
callback address: 192.168.0.2:0

the file state show file in use, permissions and other info

cat states

- ***********: { type: open, access: r-, deny: --, superblock: "00:18:4627", filename: "video/My vacations.mp4", owner: "open id:******************" }
- *********************: { type: deleg, access: r, superblock: "00:18:4627", filename: "video/My vacations.mp4" }

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .