clnt_control - Linux
Overview
clnt_control is a command-line tool used to retrieve and modify runtime properties of Network File System (NFS) clients. It provides a convenient interface for admins and developers to monitor and configure NFS client behavior, enhancing performance and resolving issues.
Syntax
clnt_control [options] [command]
Options/Flags
-h, –help: Display help information
-V, –version: Display version information
-v, –verbose: Enable verbose mode
-s, –socket: Specify the socket to use (default: /var/lib/nfs/rpc_pipefs/nfs)
-p, –port: Specify the port to use (default: 31954)
-t, –timeout: Set the connection timeout in seconds (default: 30)
Commands
list: List current NFS client properties
get: Get the value of a specific NFS client property
set: Set the value of a specific NFS client property
unmount: Request unmount of NFS mounts
Examples
Get current NFS client properties:
clnt_control list
Get the value of the readahead
property:
clnt_control get readahead
Set the tcp_keepalive
property to 1:
clnt_control set tcp_keepalive 1
Request unmount of NFS mounts:
clnt_control unmount
Common Issues
Connection refused
error:
- Ensure the NFS client service is running.
- Verify the port specified with
-p
is correct. - Check if there are any firewall rules blocking the connection.
Integration
Monitor NFS client performance:
watch clnt_control list --verbose
Automatically set tcp_keepalive
property on boot:
Create a systemd service unit:
[Unit]
Description=Set NFS client TCP keepalive property
[Service]
ExecStart=/usr/sbin/clnt_control set tcp_keepalive 1
[Install]
WantedBy=multi-user.target
Related Commands
- nfsstat: Provides statistics about NFS server performance
- nfsstatd: Exports NFS server statistics for remote monitoring
- mount: Mounts and unmounts filesystems, including NFS mounts
- exportfs: Manages NFS exports on the server side