/etc/export changes

I have a PR4100 running 5.27.157. Works great.

One thing I’d like to change, tho: when I create an nfs share, it puts something like this in /etc/exports:

"/nfs/k3s-mycluster-test" *(rw,all_squash,sync,no_wdelay,insecure_locks,insecure,no_subtree_check,anonuid=501,anongid=1000)

I want to change some of the settings, mostly the anonuid and anongid. I can edit the file and apply the changes with exports -ra, but I’ll lose them when it regenerates the file.

How can I apply those changes permanently?

1 Like

Simply install any My Cloud OS5 NAS app, then edit it’s start.sh script, and append code to make the necessary changes during the startup process.

App Path:

  • /shares/Volume_1/Nas_Prog/[APP_NAME]/start.sh

If the NFS share settings are changed via the dashboard, the app will need to be turned “OFF” then “ON” again to reapply the changes.

Example 1:

  • sed -i 's/anonuid=501/anonuid=1001/g' /etc/exports;
  • sed -i 's/anongid=1000/anongid=1002/g' /etc/exports;

Example 2:

  • sed -i 's/rw,all_squash/ro,all_squash/g' /etc/exports;

Finally, to “refresh” the exports, the following command must be executed.

Refresh Exports:

  • exportfs -ra;
1 Like

Thanks! That’s exactly what I was looking for. I may add a cron job too.

1 Like

Note to future self: exportfs -r reloads nfs exports.

1 Like

Correct, but I changed my mind and decided that simply using the OS5 script to restart the NFS server was best, because it handles everything in one shot. I added a footnote about it, just in case anyone may need to use it.

1 Like

I just uploaded a Boot Script app that may make the job a lot easier. I finished creating and testing it a few weeks ago, but hadn’t got around to uploading it yet.

Thanks. I was able to make an app of my own and install it. I made a Docker image to help me run the build: docker/mksapkg: A simple docker image to help building apps for Western Digital MyCloud devices. - mksapkg - Gitea: Git with a cup of tea

BTW, nfs restart wipes out the changes to /etc/exports, so I had to do a exportfs -ra to get it to work.

1 Like

Now that I think about it, that makes sense, because the WD NFS script would restore the default settings. I’ll change my previous post accordingly.