Chapter 4. Enabling pNFS SCSI layouts in NFS
You can configure the NFS server and client to use the pNFS SCSI layout for accessing data. pNFS SCSI is beneficial in use cases that involve longer-duration single-client access to a file.
- Both the client and the server must be able to send SCSI commands to the same block device. That is, the block device must be on a shared SCSI bus.
- The block device must contain an XFS file system.
- The SCSI device must support SCSI Persistent Reservations as described in the SCSI-3 Primary Commands specification.
4.1. The pNFS technology
The pNFS architecture improves the scalability of NFS. When a server implements pNFS, the client is able to access data through multiple servers concurrently. This can lead to performance improvements.
pNFS supports the following storage protocols or layouts on RHEL:
4.2. pNFS SCSI layouts
The SCSI layout builds on the work of pNFS block layouts. The layout is defined across SCSI devices. It contains a sequential series of fixed-size blocks as logical units (LUs) that must be capable of supporting SCSI persistent reservations. The LU devices are identified by their SCSI device identification.
pNFS SCSI performs well in use cases that involve longer-duration single-client access to a file. An example might be a mail server or a virtual machine housing a cluster.
Operations between the client and the server
When an NFS client reads from a file or writes to it, the client performs a
LAYOUTGET operation. The server responds with the location of the file on the SCSI device. The client might need to perform an additional operation of
GETDEVICEINFO to determine which SCSI device to use. If these operations work correctly, the client can issue I/O requests directly to the SCSI device instead of sending
WRITE operations to the server.
Errors or contention between clients might cause the server to recall layouts or not issue them to the clients. In those cases, the clients fall back to issuing
WRITE operations to the server instead of sending I/O requests directly to the SCSI device.
To monitor the operations, see Monitoring pNFS SCSI layouts functionality.
pNFS SCSI handles fencing through the assignment of reservations. Before the server issues layouts to clients, it reserves the SCSI device to ensure that only registered clients may access the device. If a client can issue commands to that SCSI device but is not registered with the device, many operations from the client on that device fail. For example, the
blkid command on the client fails to show the UUID of the XFS file system if the server has not given a layout for that device to the client.
The server does not remove its own persistent reservation. This protects the data within the file system on the device across restarts of clients and servers. In order to repurpose the SCSI device, you might need to manually remove the persistent reservation on the NFS server.
4.3. Checking for a SCSI device compatible with pNFS
This procedure checks if a SCSI device supports the pNFS SCSI layout.
# dnf install sg3_utils
On both the server and client, check for the proper SCSI device support:
# sg_persist --in --report-capabilities --verbose path-to-scsi-device
Ensure that the Persist Through Power Loss Active (
PTPL_A) bit is set.
Example 4.1. A SCSI device that supports pNFS SCSI
The following is an example of
sg_persistoutput for a SCSI device that supports pNFS SCSI. The
inquiry cdb: 12 00 00 00 24 00 Persistent Reservation In cmd: 5e 02 00 00 00 00 00 20 00 00 LIO-ORG block11 4.0 Peripheral device type: disk Report capabilities response: Compatible Reservation Handling(CRH): 1 Specify Initiator Ports Capable(SIP_C): 1 All Target Ports Capable(ATP_C): 1 Persist Through Power Loss Capable(PTPL_C): 1 Type Mask Valid(TMV): 1 Allow Commands: 1 Persist Through Power Loss Active(PTPL_A): 1 Support indicated in Type mask: Write Exclusive, all registrants: 1 Exclusive Access, registrants only: 1 Write Exclusive, registrants only: 1 Exclusive Access: 1 Write Exclusive: 1 Exclusive Access, all registrants: 1
4.4. Setting up pNFS SCSI on the server
This procedure configures an NFS server to export a pNFS SCSI layout.
- On the server, mount the XFS file system created on the SCSI device.
Configure the NFS server to export NFS version 4.1 or higher. Set the following option in the
[nfsd]section of the
Configure the NFS server to export the XFS file system over NFS with the
Example 4.2. An entry in /etc/exports to export pNFS SCSI
The following entry in the
/etc/exportsconfiguration file exports the file system mounted at
allowed.example.comclient as a pNFS SCSI layout:
4.5. Setting up pNFS SCSI on the client
This procedure configures an NFS client to mount a pNFS SCSI layout.
- The NFS server is configured to export an XFS file system over pNFS SCSI. See Setting up pNFS SCSI on the server.
On the client, mount the exported XFS file system using NFS version 4.1 or higher:
# mount -t nfs -o nfsvers=4.1 host:/remote/export /local/directory
Do not mount the XFS file system directly without NFS.
4.6. Releasing the pNFS SCSI reservation on the server
This procedure releases the persistent reservation that an NFS server holds on a SCSI device. This enables you to repurpose the SCSI device when you no longer need to export pNFS SCSI.
You must remove the reservation from the server. It cannot be removed from a different IT Nexus.
# dnf install sg3_utils
Query an existing reservation on the server:
# sg_persist --read-reservation path-to-scsi-device
Example 4.3. Querying a reservation on /dev/sda
# *sg_persist --read-reservation /dev/sda* LIO-ORG block_1 4.0 Peripheral device type: disk PR generation=0x8, Reservation follows: Key=0x100000000000000 scope: LU_SCOPE, type: Exclusive Access, registrants only
Remove the existing registration on the server:
# sg_persist --out \ --release \ --param-rk=reservation-key \ --prout-type=6 \ path-to-scsi-device
Example 4.4. Removing a reservation on /dev/sda
# sg_persist --out \ --release \ --param-rk=0x100000000000000 \ --prout-type=6 \ /dev/sda LIO-ORG block_1 4.0 Peripheral device type: disk