Note: this note pertains to WD MyCloud running firmware v04.06.00-111
.
By default, WD MyCloud running OS 3, firmware v04.06.00-111
does not show an option to share via NFS. However, after years of getting tired of the slow CIFS / SMB shares, I was curious if the device actually supported NFS shares, but just did not advertise it on the UI, manuals, and other documentation.
Surprise, surprise, running rpcinfo -p <nas-ip> | grep nfs
revealed a bunch of RPC services (in particular 10003
, aka NFS) running on the usual 2049
port.
A simple mount -t nfs nas-ip:/share /mnt/mountPoint
pointed at a version mismatch, that was fixed by adding -o nfsvers=3
to the mount command.
However, I kept getting permission denied for eithe ls
or for cd
commands. Turns out the default setup of NFS on WD MyCloud wasn’t tuned to allow mounting the shares using the NFS protocol by clients. That probably explains why the device didn’t advertise this capability. But, it’s software, and should be fixable for the technically inclined. Time to roll up my sleeves :-)
Turns out the default setup in /etc/exports
was the culprit:
/nfs *(rw,all_squash,sync,no_subtree_check,insecure,crossmnt,anonuid=65534,anongid=1000)
The anonuid
of 65534
(the uid of the anonymous
user) didn’t match the uid
of the user I was running as on the client machine. Technically, per the man page, this shouldn’t have mattered given the all_squash
option in /etc/exports
should translate to anonymous
user. But…
In any case, there are two ways around this:
- Remove
anonuid=65534,anongid=1000
, and let NFS map the permissions to the current user, or - Adjust the
anonuid
, andanongid
to match the “current” user (assuming the user uid / gid matches in all the places access is intended).
Now,
- is trivial, and works well.
- is a bit a more work:
On the client, figure out the uid
and gid
of the current user:
- As the user you wish to access the share, run
id
, and note the uid and gid numbers
On NFS server:
- Check if
/etc/passwd
shows any user and group with that same uid, or gid numbers from the client - If no such group exists, run
groupadd <group-name> -g <gid-from-client>
, else skip this step - If no such user exits, run
useradd <user> -u <uid-from-client> -g <gid-from-client>
- Update the exports line in
/etc/exports
, settinganonuid=uid-from-client
, andanongid=gid-from-client
- Restart NFS server:
service nfs-kernel-server restart
Once again, on the client:
- Mount the share:
mount -t nfs nfs.server:/share /mnt/mountPoint -o nfsvers=3
, or equivalently in/etc/fstab
:nfs.server:/share /mnt/mountPoint nfs nfsvers=3 0 0
It’s wonderful how ‘hackable’ the Unix / Linux based systems are. Western Digital announced an end-of-life for my device. However, this ‘hack’ has prolonged the life of the device, keeping it from the dump – and it works just great!
And, thanks to NFS, even more performant than before!