NFS fixed Port


How can I run NFS on the EX2 on a fixed Port? I can’t use the normal dynamic Port Algorythm because many things. So I need this static. I can’t find the normal Debian Options for that. So i ask how can I do that?


Welcome to the Community.

Hopefully an experienced User has tried something similar.

Can’t get an experienced Person from WD get here to help the Peoples? I see in this Forum only Person with Problems, but the really bad fact ist the most Problems doesn’t really get solved. Why is there a Forum with no Person who can help? I can’t understand this. I think it’s a really big fault for me to buy a Western Digital Product…

While I understand where you’re coming from, I believe you are misunderstanding the very purpose of the WD Community, which is _ user-to-user _ interaction. Staff members may post once in a while, but Western Digital has official, direct support channels for addressing technical issues. Users should not expect constant, steady, and/or direct responses from WD Staff members while on the forum.

Hopefully the Support Teams will be able to address your concerns.

Nice, the WD Support want’s to help me exactly 0.00. But I learned something, never buy anything again from WD.

I know this is a very old thread, but I am compelled to answer this question, after spending nearly an entire day trying to figure this out myself, and seeing that there was not even an attempt at an answer here. Other people (like myself) read these old threads looking for answers, so I am providing one, even if the original poster is no longer active or interested.

The following answer is for a MyCloud generation 2, but will probably work on other WD NAS appliances as well with some revision.

Basically, WD has gone out of their way to make this very difficult to do. The behavior is controlled by a script, contained inside a cramfs container, which gets mounted at /usr/lib/modules. A symlink exists in /usr/sbin that points to this location, for a file named ‘nfs’.

/usr/sbin/nfs → /usr/lib/modules/nfs

This is a typical start/stop script that really belongs in /etc/init.d, but for whatever reason, lives in /usr/sbin. Again, it actually resides on a read-only cramfs container.

This script is what actually sets up the daemons that service NFS sharing, and these are directly invoked by this script. They do not reference any configuration files, ANYWHERE, to control invocation other than for “did user enable NFS yes/no?” and a do-nothing section if that is so. To make the daemons use static port numbers (for statd and mountd specifically-- RPC and pals already use default ports that are static at 111 and 2049), you need to edit this script, and add the appropriate arguments to the invocation. (typically -p [port] ) That means you need to copy the script to writable storage. No biggie, but making the symlink point to the edited version of the script persistently is tricky, since the root filesystem (and thus /usr/sbin) is hosted by a ramdisk, and thus is volatile storage, and gets recreated from scratch on every boot.

There are instructions on how to hijack the stime section of the device’s config.xml so that the NAS will execute a user script on startup here:

The combination of editing the nfs script, saving it on a persistent and writable location, creating a startup script to delete and recreate the the symbolic link so that it points at the right place and then restart NFS will cause the NAS to use the arbitrarily defined port numbers of your choosing, which will allow you to use NFS past a NAT firewall.

I have tested it, it works.


I hope this helps lots of other people as well.