zilexa / Homeserver

Lightweight home server based on microservices, usable as desktop workstation

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Persistence of /proc/fs/nfsd/version setting

void-m4110c opened this issue · comments

Hi,

first I want to thank you for your great work and your effort to get NFS4.2 running!

I just wonder if there is a way how we could persist the "-4.1" setting in /proc/fs/nfsd/version... It's allways gone after reboot.

I thought about creating a systemd service file that runs after proc-fs-nfsd.mount (which apparently sets up the /proc stuff) and before nfs-server.service...

But as I'm a Gentoo user and have not worked with systemd extensively, I have no idea how to do that, yet.

Do you have a hint maybe?

Thanks in advance!

I solved the issue 😄

  1. Created a systemd service file under /etc/systemd/system/nfs-4.2-proc.service.
  • nfs-4.2-proc.service:
[Unit]
Description=Change setting in "/proc/fs/nfsd/version"
Requires=network.target proc-fs-nfsd.mount
After=network.target proc-fs-nfsd.mount

Before=nfs-server.service

[Service]
ExecStart=/bin/sh /root/bin/nfs-4.2-proc.sh

[Install]
WantedBy=multi-user.target
  1. Wrote the called shell script under /root/bin/nfs-4.2-proc.sh.
  • nfs-4.2-proc.sh:
#!/bin/sh

echo "-2 -3 +4 -4.1 +4.2" > /proc/fs/nfsd/versions
  1. Amended the default nfs-server service file via systemctl edit --full nfs-server.service so it contains:
    • Requires=nfs-4.2-proc.service
    • After=nfs-4.2-proc.servcie
  • nfs-server.service:
[Unit]
Description=NFS server and services
DefaultDependencies=no
Requires=network.target proc-fs-nfsd.mount
##### HERE... #####
Requires=nfs-4.2-proc.service
Requires=nfs-mountd.service 
Wants=rpcbind.socket
Wants=nfs-idmapd.service

After=local-fs.target
##### ... AND HERE #####
After=nfs-4.2-proc.servcie
After=network.target proc-fs-nfsd.mount rpcbind.socket nfs-mountd.service
After=nfs-idmapd.service rpc-statd.service
Before=rpc-statd-notify.service

# GSS services dependencies and ordering
Wants=auth-rpcgss-module.service
After=rpc-gssd.service gssproxy.service rpc-svcgssd.service

# start/stop server before/after client
Before=remote-fs-pre.target

Wants=nfs-config.service
After=nfs-config.service

[Service]
EnvironmentFile=-/run/sysconfig/nfs-utils

Type=oneshot
RemainAfterExit=yes
ExecStartPre=/usr/sbin/exportfs -r
ExecStart=/usr/sbin/rpc.nfsd $RPCNFSDARGS
ExecStop=/usr/sbin/rpc.nfsd 0
ExecStopPost=/usr/sbin/exportfs -au
ExecStopPost=/usr/sbin/exportfs -f

ExecReload=/usr/sbin/exportfs -r

[Install]
WantedBy=multi-user.target

Maybe this is useful for someone and if you like you could even include something like this in the README.md.

greetz

I don't use NFS anymore and I am also switching to Manjaro (Arch based) as it has a MUCH better out of the box experience, plus has the best App Store I've seen on the desktop, comparable to Apple. No need for messing with command line so much + everything is auto updated.

I will definitely test NFS once I've switched (and update this guide to Manjaro instead of Ubuntu Budgie). Perhaps if you also decide to switch you can test it as well by then.
I hope to switch in a few weeks and update this documentation before end of year.