To turn the MBWE into a NFS server, follow the following steps:
Please note, NFS is no longer included on newer firmware versions 2.00.15+. You can recover NFS from the backup images in the rescue thread.
Installation
In /etc/init.d/, create the following script (taken from WD Online Forum) to start/stop NFS services:
#!/bin/sh
#
# Start NFS
#
start() {
echo "Starting NFS"
/sbin/modprobe nfsd
sleep 2
start-stop-daemon --start --exec /sbin/portmap
start-stop-daemon --start --exec /usr/sbin/rpc.mountd
start-stop-daemon --start --exec /usr/sbin/rpc.nfsd
start-stop-daemon --start --exec /usr/sbin/rpc.statd
start-stop-daemon --start --exec /usr/sbin/rpc.lockd
start-stop-daemon --start --exec /usr/sbin/rpc.rquotad
/usr/sbin/exportfs -a # explicit exportfs is required!
}
stop() {
echo "Stopping NFS"
start-stop-daemon --stop --exec /usr/sbin/rpc.rquotad
start-stop-daemon --stop --exec /usr/sbin/rpc.lockd
start-stop-daemon --stop --exec /usr/sbin/rpc.statd
start-stop-daemon --stop --exec /usr/sbin/rpc.nfsd
start-stop-daemon --stop --exec /usr/sbin/rpc.mountd
start-stop-daemon --stop --exec /sbin/portmap
}
restart() {
stop
start
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
cleanup)
;;
*)
echo $"Usage: $0 {start|stop|restart}"
exit 1
esac
exit $?
A good name for the script would be nfs.sh. Don't forget to make it executable with a chmod 755 /etc/init.d/nfs.sh .
The NFS portmap version installed in the mybook requires that user "rpc" and group "rpc" exists, but you have to create it yourself. Run the following commands:
[root@nas init.d]# addgroup rpc
[root@nas init.d]# adduser -h /var/lib/nfs -g "RPC Service User" -s /sbin/nologin -G rpc -D rpc
If you want to verify the user/group was created, examine /etc/passwd and /etc/group:
$ grep rpc /etc/passwd
rpc:x:1003:1003:RPC Service User:/var/lib/nfs:/sbin/nologin
$ grep rpc /etc/group
rpc:x:1003:
Choosing Shares
Finally, you'll need to create/edit the /etc/exports file to contain something like:
/shares/internal/PUBLIC 192.168.0.0/16(rw,sync,insecure)
The above subnet should work for most people, but change it to match if necessary. Note that there is no space between the subnet address and the opening parenthesis. Also make sure the name resolution of the client in /etc/hosts is correct. If you edit the /etc/exports file whilst NFS service is running, you can apply changes to the live sever by running exportfs -a (as root).
Parameter insecure seems to be necessary to fix the following message (known to be a problem for mac clients):
Feb 14 00:19:58 nas user.warn kernel: nfsd: request from insecure port (192.168.1.84:49614)!
Feb 14 00:21:17 nas user.notice syslog: authenticated mount request from cslaptop.config:1016 for /shares/internal/PUBLIC (/shares/internal/PUBLIC)
Start the service and you will be in business!
[root@nas init.d]# /etc/init.d/nfs.sh start
Starting NFS
[root@nas init.d]#
Autostarting NFS
To have nfs.sh autostart, edit the file /etc/init.d/post_network_start.sh. Be particularly careful, as if you mess up this file the boot scripts may hang. I would advise starting nfs.sh below SSHD and commenting out mionet.sh if you do not use the service.
#!/bin/sh
#
<snip>
SCRIPTS_PATH=/etc/init.d
STATUS_FILES_PATH=/var/run
POST_NETWORK_STARTED_FILE=$STATUS_FILES_PATH/post_network_started
start() {
if [ ! -e "$POST_NETWORK_STARTED_FILE" ]
then
$SCRIPTS_PATH/crond.sh start
# $SCRIPTS_PATH/mionet.sh start
$SCRIPTS_PATH/nfs.sh start # Add NFS service!!!
touch $POST_NETWORK_STARTED_FILE
fi
}
stop() {
if [ -e "$POST_NETWORK_STARTED_FILE" ]
then
# $SCRIPTS_PATH/mionet.sh stop
$SCRIPTS_PATH/crond.sh stop
$SCRIPTS_PATH/nfs.sh stop # Add NFS services!!!
rm $POST_NETWORK_STARTED_FILE
fi
}
restart() {
stop
start
}
cleanup() {
rm -f $POST_NETWORK_STARTED_FILE
$SCRIPTS_PATH/nfs.sh cleanup # Add NFS services !!!
$SCRIPTS_PATH/crond.sh cleanup
# $SCRIPTS_PATH/mionet.sh cleanup
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
cleanup)
cleanup
;;
*)
echo $"Usage: $0 {start|stop|restart}"
exit 1
esac
exit $?
Now also read http://wiki.linux-nfs.org/wiki/index.php/NFS_Howto_Optimization to max out your nfs.
See this thread for more info: http://mybookworld.wikidot.com/forum/t-28307/nfs

























