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)

FAQs

What is Nfsd in Linux? ›

The nfsd program is an NFS service daemon that handles client filesystem requests. Unlike on some other systems, nfsd operates as a normal user-level process. The server also differs from other NFS server implementations in that it mounts an entire file hierarchy not limited by the boundaries of physical file-systems.

How to check NFS version in Linux 7? ›

Checking the Version of NFS That an NFS Server Is Using
  1. Overview. Network File System (NFS) is a widely used protocol for file sharing in Linux and other Unix-like operating systems. ...
  2. Using the showmount Command. ...
  3. Using the rpcinfo Command. ...
  4. Using the nfsstat Command. ...
  5. Using the /proc/mounts File. ...
  6. Conclusion.
Mar 18, 2024

How to setup NFS on RHEL 7? ›

  1. Step 1: Downloading and Installing. Yum package manager is used to install nfs-utils package. ...
  2. Step 2: Enable and Start NFS Server. Start the nfs-server and enable to make them bootable on the next reboot $ sudo systemctl enable rpcbind. ...
  3. Step 3: Export shared directory. ...
  4. Step 4: Client.
Jun 16, 2019

What is the NFS file system in Linux? ›

The Network File System (NFS) is a protocol that allows you to set up storage locations on your network. When you have NFS set up, your users can treat a remote hard drive as if it were attached to their computer, just like they might a USB thumb drive.

How to start NFS server Linux? ›

Start the NFS Server
  1. Set the firewall to allow NFS traffic. Copy. sudo firewall-cmd --permanent --zone=public --add-service=nfs sudo firewall-cmd --reload sudo firewall-cmd --list-all. ...
  2. Enable and start the NFS service. Copy. sudo systemctl enable --now nfs-server showmount -e.

How to connect to an NFS server? ›

NAS - Connecting via NFS on OSX
  1. Click on "Go" in finder.
  2. Click on "connect to server"
  3. Enter the following "NFS://<device name or IP>:/shares/<share name>"
  4. Click "Connect" and fill in a username and password when asked for them. (This is the NAS user, not the Mac user.)

How do I know if NFS is working on Linux? ›

You can use the ps -ef | grep rpc. statd commands to check for this process.

Where is NFS configuration file in Linux? ›

All NFS related services read a single configuration file: /etc/nfs.

What is the latest version of NFS Linux? ›

NFSv4, the current version of NFS, and other versions subsequent to NFS version 2 (NFSv2) are usually compatible after client and server machines negotiate a connection.

What is the port number for NFS in Linux? ›

Determine which ports to open​

PortMapper: tcp/udp 111 (default on most Linux distributions) NFSd: tcp/udp 2049 (default on most Linux distributions)

What are the services required for NFS in Linux? ›

NFS Configuration Services
  • /etc/exports – The main configuration file, which stipulates the filesystems or directories to be exported and accessed by remote users.
  • /etc/fstab – This is a file that contains entries of mounted partitions. ...
  • /etc/sysconfig/nfs – It defines the ports needed during the running of RPC services.
Sep 4, 2023

What is NFS server configuration? ›

NFS, or Network File System, is a distributed file system protocol that allows you to mount remote directories on your server. This allows you to manage storage space in a different location and write to that space from multiple clients.

What is an example of NFS? ›

NFS is typically used for sharing big files or a large volume of files across multiple computers within a network. For example, large video files are shared between editors at a production house. A single file could be in the hundreds of gigabytes, with multiple collaborators working on it.

What is the purpose of an NFS server? ›

The Network File System (NFS) is a mechanism for storing files on a network. It is a distributed file system that allows users to access files and directories located on remote computers and treat those files and directories as if they were local.

Is NFS still used? ›

Network File System (NFS) is a protocol that allows users to access files stored on a remote machine. Although decades old, it's still widely used by many companies that need to make their resources available to users through corporate networks.

Why use NFS in Linux? ›

NFS allows a system to share directories and files with others over a network. By using NFS, users and programs can access files on remote systems almost as if they were local files.

What is RPC NFSD? ›

The rpc. nfsd program implements the user level part of the NFS service. The main functionality is handled by the nfsd kernel module. The user space program merely specifies what sort of sockets the kernel service should listen on, what NFS versions it should support, and how many kernel threads it should use.

What is NFS daemons in Linux? ›

The mountd and nfsd daemons are run on systems that are servers. The automatic startup of the server daemons depends on the existence of entries that are labeled with the NFS file-system type in /etc/dfs/sharetab. To support NFS file locking, the lockd and statd daemons are run on NFS clients and servers.

How to check NFS directory in Linux? ›

The most straightforward way to check NFS mounts on Linux is by using the mount command. The key pieces here are: nfs-server:/export/directories - The NFS export on the server. /mount/point - Where the share is mounted locally.

Top Articles
Latest Posts
Article information

Author: Manual Maggio

Last Updated:

Views: 6408

Rating: 4.9 / 5 (69 voted)

Reviews: 84% of readers found this page helpful

Author information

Name: Manual Maggio

Birthday: 1998-01-20

Address: 359 Kelvin Stream, Lake Eldonview, MT 33517-1242

Phone: +577037762465

Job: Product Hospitality Supervisor

Hobby: Gardening, Web surfing, Video gaming, Amateur radio, Flag Football, Reading, Table tennis

Introduction: My name is Manual Maggio, I am a thankful, tender, adventurous, delightful, fantastic, proud, graceful person who loves writing and wants to share my knowledge and understanding with you.