<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
    <channel>
        <title>Storage on Di</title>
        <link>https://dixu.ddns.net/tags/storage/</link>
        <description>Recent content in Storage on Di</description>
        <generator>Hugo -- gohugo.io</generator>
        <language>en-us</language>
        <lastBuildDate>Thu, 24 Sep 2026 12:00:00 -0400</lastBuildDate><atom:link href="https://dixu.ddns.net/tags/storage/index.xml" rel="self" type="application/rss+xml" /><item>
            <title>Configure an NFSv4 File Server on Ubuntu 24.04 LTS</title>
            <link>https://dixu.ddns.net/p/configure-an-nfsv4-file-server-on-ubuntu-24.04-lts/</link>
            <pubDate>Wed, 05 May 2021 11:27:17 -0400</pubDate>
            <guid>https://dixu.ddns.net/p/configure-an-nfsv4-file-server-on-ubuntu-24.04-lts/</guid>
            <description>&lt;p&gt;&lt;a class=&#34;link&#34; href=&#34;https://ubuntu.com/server/docs/how-to/networking/install-nfs/&#34;  title=&#34;Official&#34;&#xA;     target=&#34;_blank&#34; rel=&#34;noopener&#34;&#xA;    &gt;Ubuntu NFS Documentation&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a class=&#34;link&#34; href=&#34;https://manpages.ubuntu.com/manpages/noble/man5/exports.5.html&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;&#xA;    &gt;NFS Exports Manual&lt;/a&gt;&lt;/p&gt;&#xA;&lt;h2 id=&#34;environment&#34;&gt;Environment&#xA;&lt;/h2&gt;&lt;p&gt;This guide configures an NFSv4.1 and NFSv4.2 server on Ubuntu 24.04 LTS. The example uses:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;NFS server: &lt;code&gt;nfs-server.example.com&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Trusted client network: &lt;code&gt;192.168.2.0/24&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Server directory: &lt;code&gt;/srv/nfs/share&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;NFSv4 client path: &lt;code&gt;/share&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Client mount point: &lt;code&gt;/mnt/nfs-share&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Shared group: &lt;code&gt;nfsshare&lt;/code&gt;, numeric GID &lt;code&gt;2000&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Replace the hostnames, subnet, paths, and GID with values appropriate for your network. Reserve the selected GID in your identity-management system so it is not assigned to another group.&lt;/p&gt;&#xA;&lt;p&gt;NFS with the default &lt;code&gt;sec=sys&lt;/code&gt; mode trusts numeric user and group IDs supplied by the client. It does not encrypt file traffic and is suitable only for trusted clients on a private network or VPN. Use NFS with Kerberos and &lt;code&gt;sec=krb5p&lt;/code&gt; when clients require strong authentication and encrypted traffic.&lt;/p&gt;&#xA;&lt;h2 id=&#34;install-the-nfs-server&#34;&gt;Install the NFS Server&#xA;&lt;/h2&gt;&lt;p&gt;Update the package index and install the server package:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;sudo apt update&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;sudo apt install -y nfs-kernel-server&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Enable and start the service:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;sudo systemctl &lt;span class=&#34;nb&#34;&gt;enable&lt;/span&gt; --now nfs-kernel-server.service&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;sudo systemctl status nfs-kernel-server.service --no-pager&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;enable-nfsv41-and-nfsv42-only&#34;&gt;Enable NFSv4.1 and NFSv4.2 Only&#xA;&lt;/h2&gt;&lt;p&gt;Ubuntu 22.04 and later use &lt;code&gt;/etc/nfs.conf&lt;/code&gt; and optional snippets under &lt;code&gt;/etc/nfs.conf.d&lt;/code&gt;. Create a local override:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;sudo install -d -m &lt;span class=&#34;m&#34;&gt;0755&lt;/span&gt; /etc/nfs.conf.d&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;sudoedit /etc/nfs.conf.d/local.conf&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Add:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-ini&#34; data-lang=&#34;ini&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;k&#34;&gt;[nfsd]&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;na&#34;&gt;vers3&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;s&#34;&gt;n&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;na&#34;&gt;vers4&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;s&#34;&gt;y&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;na&#34;&gt;vers4.0&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;s&#34;&gt;n&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;na&#34;&gt;vers4.1&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;s&#34;&gt;y&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;na&#34;&gt;vers4.2&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;s&#34;&gt;y&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This configuration removes the NFSv3 dependency on the externally reachable &lt;code&gt;rpcbind&lt;/code&gt; and &lt;code&gt;mountd&lt;/code&gt; protocols. NFSv4 uses TCP port 2049 for normal client access.&lt;/p&gt;&#xA;&lt;p&gt;Restart the server and check the enabled protocol versions:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;sudo systemctl restart nfs-kernel-server.service&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;sudo cat /proc/fs/nfsd/versions&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The output should show NFSv3 and NFSv4.0 disabled and NFSv4.1 and NFSv4.2 enabled, similar to &lt;code&gt;-3 +4 -4.0 +4.1 +4.2&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Display the effective non-default NFS configuration when troubleshooting:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;sudo nfsconf --dump&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;create-the-shared-directory&#34;&gt;Create the Shared Directory&#xA;&lt;/h2&gt;&lt;p&gt;Create a group with a fixed GID. The same numeric GID will be configured on every Linux client:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;sudo groupadd --gid &lt;span class=&#34;m&#34;&gt;2000&lt;/span&gt; nfsshare&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;If the group already exists, verify its GID instead of creating it again:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;getent group nfsshare&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Create the NFSv4 pseudo-root and the writable share:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;sudo install -d -o root -g root -m &lt;span class=&#34;m&#34;&gt;0755&lt;/span&gt; /srv/nfs&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;sudo install -d -o root -g nfsshare -m &lt;span class=&#34;m&#34;&gt;2770&lt;/span&gt; /srv/nfs/share&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The set-group-ID bit in mode &lt;code&gt;2770&lt;/code&gt; makes new files and directories inherit the &lt;code&gt;nfsshare&lt;/code&gt; group. Local server accounts that need write access can also be added to this group.&lt;/p&gt;&#xA;&lt;h2 id=&#34;configure-the-exports&#34;&gt;Configure the Exports&#xA;&lt;/h2&gt;&lt;p&gt;Open the export table:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;sudoedit /etc/exports&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Add these two lines:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-text&#34; data-lang=&#34;text&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;/srv/nfs 192.168.2.0/24(ro,fsid=0,sync,no_subtree_check,root_squash)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;/srv/nfs/share 192.168.2.0/24(rw,sync,no_subtree_check,root_squash)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The first line defines the NFSv4 root. The second exports the writable directory as &lt;code&gt;/share&lt;/code&gt; to clients.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;rw&lt;/code&gt; permits writes to the shared directory.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;sync&lt;/code&gt; commits changes to stable storage before the server replies.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;no_subtree_check&lt;/code&gt; avoids subtree verification problems when files are renamed.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;root_squash&lt;/code&gt; maps client root requests to the anonymous identity and is enabled by default; specifying it documents the intended security behavior.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;fsid=0&lt;/code&gt; marks the distinguished NFSv4 root.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Do not add &lt;code&gt;no_root_squash&lt;/code&gt; for a general file share. It lets a client administrator act as server root on the exported filesystem and can permit modification of root-owned files.&lt;/p&gt;&#xA;&lt;p&gt;Check the syntax, apply the configuration, and display the active exports:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;sudo exportfs -rav&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;sudo exportfs -v&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;showmount -e&lt;/code&gt; queries the older mount protocol and is not a reliable way to inspect an NFSv4-only server. Use &lt;code&gt;exportfs -v&lt;/code&gt; on the server and perform a real NFSv4 mount from a client.&lt;/p&gt;&#xA;&lt;h2 id=&#34;restrict-the-firewall&#34;&gt;Restrict the Firewall&#xA;&lt;/h2&gt;&lt;p&gt;If UFW is active, allow TCP 2049 only from the trusted client network:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;sudo ufw allow from 192.168.2.0/24 to any port &lt;span class=&#34;m&#34;&gt;2049&lt;/span&gt; proto tcp comment &lt;span class=&#34;s1&#34;&gt;&amp;#39;NFSv4 trusted clients&amp;#39;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;sudo ufw status verbose&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Do not expose NFS directly to the public internet. Apply an equivalent source-restricted rule on upstream routers, cloud security groups, and other host firewalls.&lt;/p&gt;&#xA;&lt;h2 id=&#34;configure-an-ubuntu-client&#34;&gt;Configure an Ubuntu Client&#xA;&lt;/h2&gt;&lt;p&gt;Install the client utilities:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;sudo apt update&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;sudo apt install -y nfs-common&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Create the same group with the same numeric GID, then add the current user:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;sudo groupadd --gid &lt;span class=&#34;m&#34;&gt;2000&lt;/span&gt; nfsshare&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;sudo usermod --append --groups nfsshare &lt;span class=&#34;s2&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span class=&#34;nv&#34;&gt;$USER&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;If the group already exists, verify that it uses GID &lt;code&gt;2000&lt;/code&gt;. Sign out and back in after changing group membership, then confirm it with:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;id&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Create an empty mount point:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;sudo install -d -o root -g root -m &lt;span class=&#34;m&#34;&gt;0755&lt;/span&gt; /mnt/nfs-share&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Test an NFSv4.2 mount:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;sudo mount -t nfs4 -o &lt;span class=&#34;nv&#34;&gt;vers&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;4.2,proto&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;tcp nfs-server.example.com:/share /mnt/nfs-share&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Verify the source, protocol version, and negotiated options:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;findmnt --target /mnt/nfs-share&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;nfsstat -m&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Test access as a user who belongs to &lt;code&gt;nfsshare&lt;/code&gt;:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;touch /mnt/nfs-share/client-write-test&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;ls -ln /mnt/nfs-share/client-write-test&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;rm /mnt/nfs-share/client-write-test&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;If the client kernel cannot negotiate NFSv4.2, investigate and update the client rather than silently downgrading an environment intended to require NFSv4.1 or later.&lt;/p&gt;&#xA;&lt;h2 id=&#34;configure-a-persistent-mount&#34;&gt;Configure a Persistent Mount&#xA;&lt;/h2&gt;&lt;p&gt;Back up the mount table before editing it:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;sudo cp --preserve&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;all /etc/fstab /etc/fstab.before-nfs&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;sudoedit /etc/fstab&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Add one line:&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code class=&#34;language-fstab&#34; data-lang=&#34;fstab&#34;&gt;nfs-server.example.com:/share /mnt/nfs-share nfs4 rw,hard,_netdev,nofail,x-systemd.automount,vers=4.2,proto=tcp 0 0&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;code&gt;hard&lt;/code&gt; keeps retrying an interrupted NFS request so applications do not silently receive partial I/O failures. &lt;code&gt;_netdev&lt;/code&gt; identifies a network filesystem, &lt;code&gt;nofail&lt;/code&gt; permits boot to continue when the server is unavailable, and &lt;code&gt;x-systemd.automount&lt;/code&gt; connects when the path is first accessed.&lt;/p&gt;&#xA;&lt;p&gt;Reload the generated systemd units, validate the file, and trigger the automount:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;sudo systemctl daemon-reload&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;sudo mount -a&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;ls /mnt/nfs-share&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;findmnt --target /mnt/nfs-share&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Do not copy old examples that use &lt;code&gt;nolock&lt;/code&gt;, &lt;code&gt;intr&lt;/code&gt;, or a large &lt;code&gt;actimeo&lt;/code&gt; value without a specific requirement. &lt;code&gt;nolock&lt;/code&gt; is associated with older NFS behavior, &lt;code&gt;intr&lt;/code&gt; is ignored by modern Linux kernels, and long attribute-cache periods can make file changes appear stale.&lt;/p&gt;&#xA;&lt;h2 id=&#34;windows-clients&#34;&gt;Windows Clients&#xA;&lt;/h2&gt;&lt;p&gt;The built-in Client for NFS in current Windows desktop releases supports NFSv2 and NFSv3, not NFSv4.1 or NFSv4.2. It therefore cannot mount the NFSv4-only export configured in this guide. Microsoft documents the version limits in its &lt;a class=&#34;link&#34; href=&#34;https://learn.microsoft.com/en-us/windows-server/storage/nfs/nfs-overview&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;&#xA;    &gt;NFS overview&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Use SMB for a share that must support normal Windows clients, or deploy a separately evaluated NFSv4-capable Windows client. Do not weaken this server to NFSv3 only to accommodate one desktop without also assessing the extra RPC services, firewall ports, identity mapping, and security implications.&lt;/p&gt;&#xA;&lt;h2 id=&#34;troubleshooting&#34;&gt;Troubleshooting&#xA;&lt;/h2&gt;&lt;h3 id=&#34;the-export-configuration-is-rejected&#34;&gt;The Export Configuration Is Rejected&#xA;&lt;/h3&gt;&lt;p&gt;Reapply the table in verbose mode and inspect the server journal:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;sudo exportfs -rav&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;sudo journalctl -u nfs-kernel-server.service -b --no-pager&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;In &lt;code&gt;/etc/exports&lt;/code&gt;, there must be no space between a client specification and its option list. For example, &lt;code&gt;192.168.2.0/24(rw)&lt;/code&gt; is valid, while &lt;code&gt;192.168.2.0/24 (rw)&lt;/code&gt; changes the meaning and can expose the directory with unintended defaults.&lt;/p&gt;&#xA;&lt;h3 id=&#34;the-client-cannot-reach-the-server&#34;&gt;The Client Cannot Reach the Server&#xA;&lt;/h3&gt;&lt;p&gt;Confirm name resolution and test TCP 2049:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;getent hosts nfs-server.example.com&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;nc -vz nfs-server.example.com &lt;span class=&#34;m&#34;&gt;2049&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Install &lt;code&gt;netcat-openbsd&lt;/code&gt; if &lt;code&gt;nc&lt;/code&gt; is unavailable. Check UFW, upstream firewalls, routing, and whether the client address is inside the subnet allowed by &lt;code&gt;/etc/exports&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;h3 id=&#34;the-client-receives-permission-denied&#34;&gt;The Client Receives Permission Denied&#xA;&lt;/h3&gt;&lt;p&gt;Compare the group IDs and inspect every component of the server path:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;getent group nfsshare&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;id&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;namei -l /srv/nfs/share&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The &lt;code&gt;nfsshare&lt;/code&gt; group must use the same numeric GID on the server and client. After adding a user to a supplementary group, start a new login session before testing.&lt;/p&gt;&#xA;&lt;h3 id=&#34;a-mount-is-busy&#34;&gt;A Mount Is Busy&#xA;&lt;/h3&gt;&lt;p&gt;Identify processes using the mount before unmounting it:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;sudo fuser -vm /mnt/nfs-share&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;sudo umount /mnt/nfs-share&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Stop or move the listed processes instead of using a forced unmount during active writes.&lt;/p&gt;&#xA;&lt;h2 id=&#34;remove-the-export&#34;&gt;Remove the Export&#xA;&lt;/h2&gt;&lt;p&gt;Unmount the share on each client and remove its &lt;code&gt;/etc/fstab&lt;/code&gt; entry. On the server, remove the corresponding lines from &lt;code&gt;/etc/exports&lt;/code&gt;, then reload the export table:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;sudo exportfs -rav&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;To stop providing NFS entirely:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;sudo systemctl disable --now nfs-kernel-server.service&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description>
        </item></channel>
</rss>
