For quite some time I’ve been trying to set up NFS an my MyBook World Edition (white light) to be able to mount the shared directories directly from Ubuntu.
Here is what I did:
- Enable NFS from the web front-end.
- On MBWE, adjust
/etc/exports:
- On Ubuntu, adjust /etc/fstab (my MBWE’s hostname is mybook):
- On MBWE type:
exportfs -ra
/nfs/Public *(rw,all_squash,sync,insecure,anonuid=65534,anongid=1000)
mybook:/nfs/Public /media/mybook nfs rw,user,nosuid,nodev 0 0
This seemed to have worked for a while but I noticed a few things:
- After every reboot, the statement in
/etc/exports
was back toro
instead ofrw
(which meant that the directory could only be mounted read-only). - When trying to mount the directory, I got the following error message (this didn’t seem to have occurred at the beginning of my tests?):
mount.nfs: requested NFS version or transport protocol is not supported
As I couldn’t figure out how to tell MBWE not to overwrite /etc/exports
during reboot, I added a start-up command to overwrite it with my version of the file. To do this, I added a file called S99nfsd_config
to /etc/init.d/
which contains the following lines:
#!/bin/sh
cp /etc/exports.working /etc/exports
/etc/init.d/S80nfsd restart
The file /etc/exports.working
contains my changes (see above).
The second issue is due to the way the portmapper is set up. By default, /etc/hosts.deny
contains the following line:
portmap:ALL
This means that no RPC programs can be seen from the client (try rpcinfo -p mybook from Ubuntu). I added the following line to /etc/hosts.allow
:
portmap: 192.168.1.0/255.255.255.0
Note: My MBWE and the Ubuntu client both have an IP in the range 192.168.1.1-255.
I then had to restart nfsd. Btw, the file /etc/hosts.allow
doesn’t seem to be overwritten during the boot process.
PS I might have left out some important setup steps above as I’m writing these notes from memory.
Great post! one question though. How do you make the S99nfsd_config so that it runs at boot. I think I need to run some command to make it “runnable”?
🙂
The file S99nfsd_config has to be executable. To do that, type:
chmod 755 S99nfsd_config
.