The state of the classic NFS filesystem
Dual-Protocol File Server
Setting up a file server for Linux and Unix clients using NFS, or a Samba server for Windows clients, is something that virtually every admin can handle. But if you have to support a heterogeneous landscape of users with a single file server, you will automatically be tempted to set up shares with both NFS and Samba. On the network-side, this is no problem. The actual problems for a Janus-headed file server result from the different locking types in Windows and Linux and impending inconsistencies if clients cache data. Another difficulty: NFS and CIFS organize their access control lists differently, which previously meant that only a subset of POSIX 1003.1e ACLs and Windows ACLs remained as the smallest common denominator.
NFSv4 significantly reduced the difficulty of dual-protocol operation by more closely reflecting features of Windows filesystems, and of CIFS in particular, structurally, with mandatory locking, share reservations, and delegations. NFSv4 also transmits the user and group information as UTF-8 plain text and no longer as a numeric identifier, as in NFSv3. The idmap service then converts usernames and groups to the file-server identifiers, which makes cooperating with Samba easier.
The whole thing is standardized: RFC 3010, from December 2000, established a new ACL system that is tailored to NFSv4. For example, ZFS supports ACLs exclusively according to this standard.
Greg Banks from the Cyrus IMAP project presented the Richacls project [16] at the Ottawa Linux Symposium 2010 – an implementation of NFSv4 ACLs in the Linux kernel with advanced file masking – that superimposes a consistent file rights model on all remote filesystem protocols and accesses both servers and clients. Greg Banks's co-worker on this was Suse employee Andreas Grünbacher, who is with Red Hat today. Banks manages the active Richacls project, which includes kernel code and also patches for Samba, NFS, and XFS.
NFSv4 supports named attributes – an additional byte stream that the NFS stores along with the actual file [17]. Windows supports a similar concept called alternate datastreams for its NTFS filesystem. Named attributes, by the way, are not related to the extended attributes of the ext filesystem.
Multihosts and Zero Copy
NFSv4 shares resources via a pseudo-filesystem (virtual root filesystem) so that the admin can define arbitrary share paths. Clients mount all shares with a single mount
command, which only references the NFS server. As of late, an NFSv4.1 client can also specify multiple hostnames when mounting, which promises to relieve the administrative burden of dealing with frequently changing server names.
To increase the speed, clients can establish multiple connections with the NFS server. NFS groups multiple connections in a session in what is known as session trunking [18]. There are other performance-enhancing measures in the current NFS. In case of a copy operation, the client requests the data to be copied and then copies it back to another target on the server. This method is obviously inefficient.
But with zero copy, the server itself can perform the operation, which requires only a copy-on-write copy in the simplest case. Users can create these copies manually on Btrfs and XFS systems with the cp --reflink
command. The filesystems only allocate additional storage in case of writes to the copy.
Samba supports zero copy with an IOCTL. And there's a technically very charming variant of this that outsources the virtual copy action to Btrfs [19]. NFSv4.2 offers another corresponding approach, but the patches by Anna Schumaker, who works for NetApp, are still under review [20].
Conclusions
The de facto demise of Sun Microsystems has heavily affected the NFS project. On the one hand the development – at least in terms of version numbers – is progressing very slowly. It is difficult to accurately forecast whether there will ever be an NFSv5 release. On the other hand, the missing or outdated documentation slows down any user who wants to try out new features: It is difficult for any admin to know what functionality exists in the NFS implementation packaged with their choice of Linux distribution.
Although some features work seamlessly with the current kernel and the NFS-utils, admins are forced to perform extensive research for many optional features – and to gain experience with a test setup. One complicating factor is that not every Linux distribution enables all the NFS innovations in the kernel or provides the latest NFS-utils.
The specification of the current NFSv4.1 dates back to the year 2010. Although work on NFSv4.2 began as early as 2011, the corresponding specification [21] still only exists as a design today. Among other things, version 4.2 can deal more efficiently with sparse files, named attributes, and zero copy. Newer kernels already support some functions from the NFSv4.2 specification.
These welcome developments are in risk of disappearing, however, because the current home of NFS, IETF, does little to promote NFS as a potential competitor for Samba.
Infos
- IETF, "Network File System (NFS) Version 4 Minor Version 1 Protocol": https://tools.ietf.org/html/rfc5661
- NFS project site: http://nfs.sourceforge.net
- nfs-utils Patches: http://git.linux-nfs.org/?p=steved/nfs-utils.git;a=summary
- Linux NFS wiki: http://linux-nfs.org/wiki/
- NetApp: http://www.netapp.com
- pNFS: http://www.pnfs.com
- Linux NFS mailing list: http://majordomo@vger.kernel.org?body=subscribelinux-nfs
- Webinar "pNFS – Are we there yet?": http://www.panasas.com/news/webinars/pnfs-are-we-there-yet
- Btrfs documentation: https://btrfs.wiki.kernel.org/index.php/Changelog
- Development status of individual NFSv4 features in the Linux kernel: https://www.kernel.org/doc/Documentation/filesystems/nfs/nfs41-server.txt
- Layout types in pNFS: https://tools.ietf.org/html/draft-ietf-nfsv4-layout-types-04
- pNFS file layout implementation: http://wiki.linux-nfs.org/wiki/index.php/PNFS_server_projects
- Kernel documentation for the pNFS block server: https://www.kernel.org/doc/Documentation/filesystems/nfs/pnfs-block-server.txt
- Internet draft "Parallel NFS (pNFS) Flexible File Layout": https://tools.ietf.org/html/draft-ietf-nfsv4-layout-types-04
- NFS kernel documentation: https://www.kernel.org/doc/Documentation/filesystems/nfs/
- Andreas Grünbacher, "Richacls – Native NFSv4 ACLs on Linux": http://www.bestbits.at/richacl/
- Named attributes: http://tools.ietf.org/html/rfc7530#section-5.3
- Session trunking in NFSv4.1: https://tools.ietf.org/html/rfc5661#section-2.10
- Server-side copy for Samba: https://wiki.samba.org/index.php/Server-Side_Copy
- Anna Schumaker and others, "NFSv4. 2: Add support for the COPY operation": http://thread.gmane.org/gmane.linux.nfs/77304
- Internet draft, "NFS Version 4 Minor Version 2": https://tools.ietf.org/html/draft-ietf-nfsv4-minorversion2-41
« Previous 1 2
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
News
-
Halcyon Creates Anti-Ransomware Protection for Linux
As more Linux systems are targeted by ransomware, Halcyon is stepping up its protection.
-
Valve and Arch Linux Announce Collaboration
Valve and Arch have come together for two projects that will have a serious impact on the Linux distribution.
-
Hacker Successfully Runs Linux on a CPU from the Early ‘70s
From the office of "Look what I can do," Dmitry Grinberg was able to get Linux running on a processor that was created in 1971.
-
OSI and LPI Form Strategic Alliance
With a goal of strengthening Linux and open source communities, this new alliance aims to nurture the growth of more highly skilled professionals.
-
Fedora 41 Beta Available with Some Interesting Additions
If you're a Fedora fan, you'll be excited to hear the beta version of the latest release is now available for testing and includes plenty of updates.
-
AlmaLinux Unveils New Hardware Certification Process
The AlmaLinux Hardware Certification Program run by the Certification Special Interest Group (SIG) aims to ensure seamless compatibility between AlmaLinux and a wide range of hardware configurations.
-
Wind River Introduces eLxr Pro Linux Solution
eLxr Pro offers an end-to-end Linux solution backed by expert commercial support.
-
Juno Tab 3 Launches with Ubuntu 24.04
Anyone looking for a full-blown Linux tablet need look no further. Juno has released the Tab 3.
-
New KDE Slimbook Plasma Available for Preorder
Powered by an AMD Ryzen CPU, the latest KDE Slimbook laptop is powerful enough for local AI tasks.
-
Rhino Linux Announces Latest "Quick Update"
If you prefer your Linux distribution to be of the rolling type, Rhino Linux delivers a beautiful and reliable experience.