Absolutely No Machete Juggling

Rod Hilton's rants about stuff he cares about way too much.

Using Western Digital NetCenter with Ubuntu Linux

I bought a Western Digital NetCenter drive in anticipation of switching to Linux not too long ago (wanted a place for multimedia). While Windows had no problem using the shares I set up on the drive, getting it to work in Linux has been a nightmare. After a lot of failed discussions in #ubuntu on the IRC Server, as well as a post on the Ubuntu Forum that went unanswered for a month, I figured out the problems and decided to post my own tutorial so that poor schmoes like me searching for NetCenter-specific information could find it.

Before I go through this, you'll need to see if my goal with the NetCenter is close to your own. Basically, I wanted a place for multimedia on the network, such as mp3s and the like. I wanted to be able to still download stuff using my Linux machine (my main Desktop computer), but then move stuff to the network drive. This meant that I wanted a simple directory somewhere within Linux that behaved as though I had all of my multimedia on the machine itself. In Windows, I'd map my MP3 Share to the Z: drive, so my mp3s were always at Z:. I wanted it to be similarly simple in Linux.

Preparing the Shares

Step one is to enable NFS on your shares. When you make a share in the NetCenter web admin tool, you must make sure that, for the security settings for your folder, you enable NFS.

I believe the NetCenter comes with some kind of Windows-centric application to manage shares, but I didn't bother with that. Once you find out your NetCenter's ip address, you can simply load that IP in your web browser and find the web admin tool. Make your shares through that.

I'm going to assume you have made a share called MUSIC, and you intend to place all of your mp3s there. I'm also going to assume you are making it a PUBLIC share, rather than password-protected. I'm assuming this because that's what I did, and thus I have no idea how to work with the password-protected shares. I can only assume it's about as painless as simple as working with public shares, which is to say I imagine you're going to want to pull your eyeballs out and eat them if you attempt such a thing.

Mounting in Linux

Almost all of the other tutorials on the web that discuss this kind of thing have you mount your shares using SMBFS. This is an awful idea, because SMBFS apparently has some bug in it. The end-result of this bug is that, if two threads try to access the mount concurrently, the entire mount will freeze, any application reading from it will freeze, and any program that tries to access it again will freeze. This will last a few hours (3 for me) before the share is magically available again. Oh, and if you have other mounts going to the same machine, those will freeze too.

This is particularly frustrating when you are storing MP3 files, because when you scan your library most programs will do so in a threaded manner, thus instantly breaking everything for a good 3 hours or so.

The workaround for this, I found, is to avoid SMBFS entirely and use NFS instead.

First, you need to make a directory for what you will mount to. A lot of people mount this kind of stuff inside /media, so I'll assume you want to as well (I didn't, but whatever).

Type sudo mkdir /media/mp3. This will make an mp3 directory that you will map your MUSIC share to. Now, let's mount it. Let's assume the IP address of your NetCenter drive is 192.168.0.200.

Type sudo mount -t nfs 192.168.0.200:/shares/Main/MUSIC /media/mp3

That should be it. Cd into /media/mp3 and list some files. To unmount it, type sudo umount /media/mp3.

If you wanted to mount with cifs instead, the path would simply be //IP/MUSIC, so you might be wondering what the /shares/Main is for. The Western Digital runs a flavor of linux itself, which is why using NFS is so much better. However, it hides the location of your shares in /shares/volumename/sharename. This isn't found anywhere in any documentation, and if you send Western Digital an e-mail simply asking "I'm trying to mount using NFS, what's the path to my share on the drive?" they will respond by telling you they do not support Linux. If you respond and tell them you aren't asking about Linux, you are asking about NFS, which the drive clearly supports as there is a checkbox for enabling it for every share you make, they will reply again by telling you they do not support Linux.

Western Digital loses major points with me for how they have handled this situation. It's frustrating enough that they don't support Linux on a network-attached storage device (since the most common use of NAS is enterprise, and a lot of companies run on Linux). but to refuse to help with an actual feature of their device was particularly infuriating. If support is important to you, do NOT buy a Western Digital NetCenter drive. The drive works great once you get it working correctly, but WD will not help you.

Automounting

To make it so that this is mounted when you boot your machine, type sudo gedit /etc/fstab

Then add this line to your file:

192.168.0.200:/shares/Main/MUSIC   /media/mp3  nfs  rw,user  0       0

Save the file, and do sudo mount -a in a terminal. This should reload the file and mount whatever is there. This will occur automatically when you boot from now on.

You will also notice that an icon appears on your desktop for this drive. I found this bothersome, and if you do as well, simply remove the ",user" from the config line.

Writing to the directory

You may find as you try to move files into the share, that you cannot write. In my case, I moved a lot of files onto the drive from Windows before switching to Linux, so all of my music and multimedia was already on the drive. I discovered I couldn't read any of it or move additional files to existing directories.

The following steps will 1) Make all of the directories writable for EVERYONE on the network 2) Make all of the files readable and writable for everyone on the network and 3) Change the owner of everything on the drive to "root".

This is an extremely permissive way to set up your network share. The reason I provide instructions like this is that, when the WD NetCenter is set to "public", the behavior of the drive is that everyone in windows can read and write to everything on that share. Thus, I am trying to emulate that behavior in Linux. If you want to use a more restrictive permissions scheme, you can go ahead. Feel free to add to these instructions in the comments if that is the case for you.

In any case, the first thing you need to do is set all of the directories on the drive to be read/write/execute for everyone. Type this: sudo chmod -R a+rwX /media/mp3

This will set +rw for everyone, and set the X bit for everyone if it's already set for the user (since directories have this bit set to allow directory listing, the end-effect is that directories will be set correctly). This also sets all files to be +rw, but not +x.

The next thing to do is change the owner. This is mostly for cosmetic purposes: sudo chown -R root:root /media/mp3.

That's it. Your drive should now be usable by you without having to sudo.

comments powered by Disqus