nfsd: special filesystem for controlling Linux NFS server - Linux Manuals (7) (2024)

nfsd: special filesystem for controlling Linux NFS server

Command to display nfsd manual in Linux: $ man 7 nfsd

NAME

nfsd - special filesystem for controlling Linux NFS server

SYNPOSIS

mount -t nfsd nfsd /proc/fs/nfsd

DESCRIPTION

Thenfsdfilesystem is a special filesystem which provides access to the LinuxNFS server. The filesystem consists of a single directory whichcontains a number of files. These files are actually gateways intothe NFS server. Writing to them can affect the server. Reading fromthem can provide information about the server.

This file system is only available in Linux 2.6 and later serieskernels (and in the later parts of the 2.5 development series leadingup to 2.6). This man page does not apply to 2.4 and earlier.

As well as this filesystem, there are a collection of files in theprocfsfilesystem (normally mounted at/proc)which are used to control the NFS server.This manual page describes all of these files.

Theexportfsandmountdprograms (part of the nfs-utils package) expect to find thisfilesystem mounted at/proc/fs/nfsdor/proc/fs/nfs.If it is not mounted, they will fall-back on 2.4 style functionality.This involves accessing the NFS server via a systemcall. Thissystemcall is scheduled to be removed after the 2.6 kernel series.

DETAILS

The three files in thenfsdfilesystem are:

exports
This file contains a list of filesystems that are currently exportedand clients that each filesystem is exported to, together with a listof export options for that client/filesystem pair. This is similarto the/proc/fs/nfs/exportsfile in 2.4.One difference is that a client doesn't necessarily correspond to justone host. It can respond to a large collection of hosts that arebeing treated identically.

Each line of the file contains a path name, a client name, and anumber of options in parentheses. Any space, tab, newline orback-slash character in the path name or client name will be replacedby a backslash followed by the octal ASCII code for that character.

threads
This file represents the number ofnfsdthread currently running. Reading it will show the number ofthreads. Writing an ASCII decimal number will cause the number ofthreads to be changed (increased or decreased as necessary) to achievethat number.
filehandle
This is a somewhat unusual file in that what is read from it dependson what was just written to it. It provides a transactional interfacewhere a program can open the file, write a request, and read aresponse. If two separate programs open, write, and read at the sametime, their requests will not be mixed up.

The request written tofilehandleshould be a client name, a path name, and a number of bytes. Thisshould be followed by a newline, with white-space separating thefields, and octal quoting of special characters.

On writing this, the program will be able to read back a filehandlefor that path as exported to the given client. The filehandle's lengthwill be at most the number of bytes given.

The filehandle will be represented in hex with a leading '\x'.

The directory/proc/net/rpcin theprocfsfilesystem contains a number of files and directories.The files contain statistics that can be display using thenfsstatprogram.The directories contain information about various caches that the NFSserver maintains to keep track of access permissions that differentclients have for different filesystems.The caches are:

auth.unix.ip
This cache contains a mapping from IP address to the name of theauthentication domain that the ipaddress should be treated as part of.
nfsd.export
This cache contains a mapping from directory and domain to exportoptions.
nfsd.fh
This cache contains a mapping from domain and a filesystem identifierto a directory. The filesystem identifier is stored in thefilehandles and consists of a number indicating the type of identifierand a number of hex bytes indicating the content of the identifier.

Each directory representing a cache can hold from 1 to 3 files. Theyare:

flush
When a number of seconds since epoch (1 Jan 1970) is written to thisfile, all entries in the cache that were last updated before that filebecome invalidated and will be flushed out. Writing a time in thefuture (in seconds since epoch) will flusheverything. This is the only file that will always be present.
content
This file, if present, contains a textual representation of ever entryin the cache, one per line. If an entry is still in the cache(because it is actively being used) but has expired or is otherwiseinvalid, it will be presented as a comment (with a leading hashcharacter).
channel
This file, if present, acts a channel for request from the kernel-basednfs server to be passed to a user-space program for handling.

When the kernel needs some information which isn't in the cache, itmakes a line appear in thechannelfile giving the key for the information. A user-space program shouldread this, find the answer, and write a line containing the key, anexpiry time, and the content.For example the kernel might make
nfsd 127.0.0.1
appear in theauth.unix.ip/contentfile. The user-space program might then write
nfsd 127.0.0.1 1057206953 localhost
to indicate that 127.0.0.1 should map to localhost, at least for now.

If the program uses select(2) or poll(2) to discover if it can readfrom thechannelthen it will never see and end-of-file but when all requests have beenanswered, it will block until another request appears.

In the/procfilesystem there are 4 files that can be used to enabled extra tracingof nfsd and related code. They are:/proc/sys/sunrpc/nfs_debug
/proc/sys/sunrpc/nfsd_debug
/proc/sys/sunrpc/nlm_debug
/proc/sys/sunrpc/rpc_debug
They control tracing for the NFS client, the NFS server, the NetworkLock Manager (lockd) and the underlying RPC layer respectively.Decimal numbers can be read from or written to these files. Eachnumber represents a bit-pattern where bits that are set cause certainclasses of tracing to be enabled. Consult the kernel header files tofind out what number correspond to what tracing.

AUTHOR

NeilBrown

SEE ALSO

rpc.nfsd(8),exports(5),nfsstat(8),mountd(8)exportfs(8).

Pages related to nfsd

  • nfsd (8) - NFS server process
  • nfs.systemd (7) - managing NFS services through systemd.

Linux Manuals Copyright Respective Owners. Site Copyright © SysTutorials. All Rights Reserved. Terms and Privacy

nfsd: special filesystem for controlling Linux NFS server - Linux Manuals (7) (2024)
Top Articles
Latest Posts
Article information

Author: Greg Kuvalis

Last Updated:

Views: 6132

Rating: 4.4 / 5 (75 voted)

Reviews: 90% of readers found this page helpful

Author information

Name: Greg Kuvalis

Birthday: 1996-12-20

Address: 53157 Trantow Inlet, Townemouth, FL 92564-0267

Phone: +68218650356656

Job: IT Representative

Hobby: Knitting, Amateur radio, Skiing, Running, Mountain biking, Slacklining, Electronics

Introduction: My name is Greg Kuvalis, I am a witty, spotless, beautiful, charming, delightful, thankful, beautiful person who loves writing and wants to share my knowledge and understanding with you.