Adventures with the My Book World Edition (Whitelight) NAS harddrive

Recently, I’ve been obsessing about the network here at home, now we have our own connection to the Internet and router (in the last flat, we shared this via an Ethernet cable that came from our neighbour’s flat).

I wasn’t really aware, but when I successfully bid for a 1TB My Book World Edition (MBWE) on eBay recently, I was doing a good thing, in terms of being able to hack (augment) the firmware, just like the good old Cisco Systems NSLU2 (slug). In fact, the Optware distribution mechanism that allows you to install lots of great stuff on both was developed for the slug first and is now available on many different devices. So happy day!

This is my path to getting nfs up and running so that all the computers on our home network that want to can connect to and write to the nas (the MBWE). By default, the way the MBWE sets up nfs by default, allows all users to read the drive only and not write to it.

  • I enabled ssh in the normal web gui that is part of the pre-installed firmware. You need this to perform the hacks below. If this isn’t available to you as a gui option, consult this site for the solution.
  • While in the web gui, enable the nfs service. Leave the asterisk in the allow ip addresses box (this allows access from all ip addresses. You will change this later). Get out of the web gui, you don’t need that patronising, proprietary stuff any more. I want to be able to set up this hardware (that I own) in the way I want, not how the marketing managers at Western Digital think I want.
  • Follow the instructions here to ssh in to the file system of the nas and install Optware (ipkg)
  • Once you’ve got ipkg working and in your PATH, you can install nano as an alternate text editor, which is so much more intuitive than vi, like this:
    /opt/bin/ipkg install nano
  • I got confused at this point by this page on the excellent site, which I think is for a different model of MBWE or at least one that doesn’t let you enable nfs in the web gui. My advice would be that you don’t need most of this page, so treat with caution. You will need to deal with the /etc/exports file on the MBWE though and there is useful advice on the page under ‘Choosing Shares’ about this which takes you a little way further. It explains that you need to change a line of your /etc/exports file to read: /shares/internal/PUBLIC,sync,insecure,all_squash,anonuid=33,anongid=33). On my nas, I had to adapt this line to point to the right folder which was /nfs/Public. I had to adjust the ip address and netmask to reflect my network settings and lastly I had to adjust the anonuid and anongid values. Again, let the section ‘Choosing Shares’ on the page be your guide.
  • There is a problem with this, however, which took me a while to figure out. The page which helps is here and the last entry is the one that points the way. The problem is that when you shutdown the nas and restart (I think this is a good thing to do for the planet), it overwrites the /etc/exports file with the default. To undo this, you have to set up the script suggested at the bottom of that page.
  • The last problem to solve is that for me at least, this script never ran. I confirmed this by adding a line like touch /tmp/script-ran, starting the nas up and checking for this empty file in the /tmp folder. If there was no ‘script-ran’ file, the script never got to run. I’m not sure if my solution is kosher, but it works. I made a link in /etc/init.d to the startup file at /opt/etc/init.d/S99updconf called something like S81updconf (ln -s /opt/etc/init.d/S99updconf S81updconf). What’s important to realise is that the scripts in the etc/init.d are run in numerical order if they start with a capital S. You want to wait until the nfs daemon has been started (on my system this is S80nfsd) – hence S81 at the beginning of the link.
  • Lastly, when you confirm that the MBWE is copying over /etc/exports with the new one, go ahead and alter your fstab with a line like the following: ipaddr.of.nas.server:/DataVolume/Public /nfs nfs rw,hard,intr 0 0

All done, now every machine you add that fstab line to should connect to the nas when it starts up. One of the things I really appreciate about Linux is that you can get older equipment up and running and doing exactly what you want of it, with the help of a well-informed and open-hearted community, without being bamboozled by all the marketing and gadget fetishism rife in the computer hardware business, which I am unfortunately not immune to.

PS If you run into problems getting fstab to mount the drive, make sure you have nfs-common on the client machine (i.e. the computer you want to connect to the nas from) sudo apt-get install nfs-common

This entry was posted in Bash scripting, Code, Diary, Linux and tagged , , , . Bookmark the permalink.